diff options
Diffstat (limited to 'apps/recorder/icons.c')
-rw-r--r-- | apps/recorder/icons.c | 181 |
1 files changed, 1 insertions, 180 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index baba77bc52..1306a1d770 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -73,11 +73,9 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
73 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ | 73 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #if CONFIG_LED == LED_VIRTUAL | ||
77 | /* Disk/MMC activity */ | 76 | /* Disk/MMC activity */ |
78 | const unsigned char bitmap_icon_disk[12] = | 77 | const unsigned char bitmap_icon_disk[12] = |
79 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; | 78 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; |
80 | #endif | ||
81 | 79 | ||
82 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ | 80 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ |
83 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 81 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) |
@@ -341,130 +339,6 @@ const unsigned char rockbox160x53x2[] = { | |||
341 | #endif | 339 | #endif |
342 | 340 | ||
343 | /* | 341 | /* |
344 | * Print battery icon to status bar | ||
345 | */ | ||
346 | void statusbar_icon_battery(int percent) | ||
347 | { | ||
348 | int fill; | ||
349 | char buffer[5]; | ||
350 | unsigned int width, height; | ||
351 | |||
352 | /* fill battery */ | ||
353 | fill = percent; | ||
354 | if (fill < 0) | ||
355 | fill = 0; | ||
356 | if (fill > 100) | ||
357 | fill = 100; | ||
358 | |||
359 | #if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */ | ||
360 | /* show graphical animation when charging instead of numbers */ | ||
361 | if ((global_settings.battery_display) && | ||
362 | (charge_state != 1) && | ||
363 | (percent > -1)) { | ||
364 | #else /* all others */ | ||
365 | if (global_settings.battery_display && (percent > -1)) { | ||
366 | #endif | ||
367 | /* Numeric display */ | ||
368 | snprintf(buffer, sizeof(buffer), "%3d", fill); | ||
369 | lcd_setfont(FONT_SYSFIXED); | ||
370 | lcd_getstringsize(buffer, &width, &height); | ||
371 | if (height <= STATUSBAR_HEIGHT) | ||
372 | lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - | ||
373 | width/2, STATUSBAR_Y_POS, buffer); | ||
374 | lcd_setfont(FONT_UI); | ||
375 | |||
376 | } | ||
377 | else { | ||
378 | /* draw battery */ | ||
379 | lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7); | ||
380 | lcd_vline(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2, | ||
381 | STATUSBAR_Y_POS + 4); | ||
382 | |||
383 | fill = fill * 15 / 100; | ||
384 | lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); | ||
385 | } | ||
386 | |||
387 | if (percent == -1) { | ||
388 | lcd_setfont(FONT_SYSFIXED); | ||
389 | lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - 4, | ||
390 | STATUSBAR_Y_POS, "?"); | ||
391 | lcd_setfont(FONT_UI); | ||
392 | } | ||
393 | } | ||
394 | |||
395 | /* | ||
396 | * Print volume gauge to status bar | ||
397 | */ | ||
398 | bool statusbar_icon_volume(int percent) | ||
399 | { | ||
400 | int i; | ||
401 | int volume; | ||
402 | int vol; | ||
403 | char buffer[4]; | ||
404 | unsigned int width, height; | ||
405 | bool needs_redraw = false; | ||
406 | int type = global_settings.volume_type; | ||
407 | static long switch_tick; | ||
408 | static int last_volume = -1; /* -1 means "first update ever" */ | ||
409 | |||
410 | volume = percent; | ||
411 | if (volume < 0) | ||
412 | volume = 0; | ||
413 | if (volume > 100) | ||
414 | volume = 100; | ||
415 | |||
416 | if (volume == 0) { | ||
417 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Mute], | ||
418 | ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4, | ||
419 | STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT); | ||
420 | } | ||
421 | else { | ||
422 | /* We want to redraw the icon later on */ | ||
423 | if (last_volume != volume && last_volume >= 0) { | ||
424 | switch_tick = current_tick + HZ; | ||
425 | } | ||
426 | |||
427 | /* If the timeout hasn't yet been reached, we show it numerically | ||
428 | and tell the caller that we want to be called again */ | ||
429 | if (TIME_BEFORE(current_tick,switch_tick)) { | ||
430 | type = 1; | ||
431 | needs_redraw = true; | ||
432 | } | ||
433 | |||
434 | /* display volume level numerical? */ | ||
435 | if (type) | ||
436 | { | ||
437 | snprintf(buffer, sizeof(buffer), "%2d", percent); | ||
438 | lcd_setfont(FONT_SYSFIXED); | ||
439 | lcd_getstringsize(buffer, &width, &height); | ||
440 | if (height <= STATUSBAR_HEIGHT) | ||
441 | lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - | ||
442 | width/2, STATUSBAR_Y_POS, buffer); | ||
443 | lcd_setfont(FONT_UI); | ||
444 | } else { | ||
445 | /* display volume bar */ | ||
446 | vol = volume * 14 / 100; | ||
447 | for(i=0; i < vol; i++) { | ||
448 | lcd_vline(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 6 - i / 2, | ||
449 | STATUSBAR_Y_POS + 6); | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | last_volume = volume; | ||
454 | |||
455 | return needs_redraw; | ||
456 | } | ||
457 | |||
458 | /* | ||
459 | * Print play state to status bar | ||
460 | */ | ||
461 | void statusbar_icon_play_state(int state) | ||
462 | { | ||
463 | lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, | ||
464 | STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); | ||
465 | } | ||
466 | |||
467 | /* | ||
468 | * Print play mode to status bar | 342 | * Print play mode to status bar |
469 | */ | 343 | */ |
470 | void statusbar_icon_play_mode(int mode) | 344 | void statusbar_icon_play_mode(int mode) |
@@ -478,59 +352,6 @@ void statusbar_icon_play_mode(int mode) | |||
478 | */ | 352 | */ |
479 | void statusbar_icon_shuffle(void) | 353 | void statusbar_icon_shuffle(void) |
480 | { | 354 | { |
481 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, | 355 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, |
482 | STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT); | 356 | STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT); |
483 | } | 357 | } |
484 | |||
485 | /* | ||
486 | * Print lock when keys are locked | ||
487 | */ | ||
488 | void statusbar_icon_lock(void) | ||
489 | { | ||
490 | lcd_mono_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS, | ||
491 | STATUSBAR_Y_POS, 5, 8); | ||
492 | } | ||
493 | |||
494 | #if CONFIG_LED == LED_VIRTUAL | ||
495 | /* | ||
496 | * no real LED: disk activity in status bar | ||
497 | */ | ||
498 | void statusbar_led(void) | ||
499 | { | ||
500 | lcd_mono_bitmap(bitmap_icon_disk, ICON_DISK_X_POS, | ||
501 | STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT); | ||
502 | } | ||
503 | #endif | ||
504 | |||
505 | #ifdef HAVE_RTC | ||
506 | /* | ||
507 | * Print time to status bar | ||
508 | */ | ||
509 | void statusbar_time(int hour, int minute) | ||
510 | { | ||
511 | unsigned char buffer[6]; | ||
512 | unsigned int width, height; | ||
513 | |||
514 | if ( hour >= 0 && | ||
515 | hour <= 23 && | ||
516 | minute >= 0 && | ||
517 | minute <= 59 ) { | ||
518 | if ( global_settings.timeformat ) { /* 12 hour clock */ | ||
519 | hour %= 12; | ||
520 | if ( hour == 0 ) { | ||
521 | hour += 12; | ||
522 | } | ||
523 | } | ||
524 | snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute); | ||
525 | } | ||
526 | else { | ||
527 | strncpy(buffer, "--:--", sizeof buffer); | ||
528 | } | ||
529 | |||
530 | lcd_setfont(FONT_SYSFIXED); | ||
531 | lcd_getstringsize(buffer, &width, &height); | ||
532 | if (height <= STATUSBAR_HEIGHT) | ||
533 | lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer); | ||
534 | lcd_setfont(FONT_UI); | ||
535 | } | ||
536 | #endif | ||