summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_tokens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine/skin_tokens.c')
-rw-r--r--apps/gui/skin_engine/skin_tokens.c173
1 files changed, 0 insertions, 173 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 75c3203066..50704fd66e 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -37,9 +37,6 @@
37#include "cuesheet.h" 37#include "cuesheet.h"
38#include "replaygain.h" 38#include "replaygain.h"
39#include "core_alloc.h" 39#include "core_alloc.h"
40#ifdef HAVE_LCD_CHARCELLS
41#include "hwcompat.h"
42#endif
43#include "abrepeat.h" 40#include "abrepeat.h"
44#include "lang.h" 41#include "lang.h"
45#include "misc.h" 42#include "misc.h"
@@ -577,148 +574,6 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename)
577 return pid3; 574 return pid3;
578} 575}
579 576
580#ifdef HAVE_LCD_CHARCELLS
581static void format_player_progress(struct gui_wps *gwps)
582{
583 struct wps_state *state = skin_get_global_state();
584 struct screen *display = gwps->display;
585 unsigned char progress_pattern[7];
586 int pos = 0;
587 int i;
588
589 int elapsed, length;
590 if (LIKELY(state->id3))
591 {
592 elapsed = state->id3->elapsed;
593 length = state->id3->length;
594 }
595 else
596 {
597 elapsed = 0;
598 length = 0;
599 }
600
601 if (length)
602 pos = 36 * (elapsed + state->ff_rewind_count) / length;
603
604 for (i = 0; i < 7; i++, pos -= 5)
605 {
606 if (pos <= 0)
607 progress_pattern[i] = 0x1fu;
608 else if (pos >= 5)
609 progress_pattern[i] = 0x00u;
610 else
611 progress_pattern[i] = 0x1fu >> pos;
612 }
613
614 display->define_pattern(gwps->data->wps_progress_pat[0], progress_pattern);
615}
616
617static void format_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
618{
619 static const unsigned char numbers[10][4] = {
620 {0x0e, 0x0a, 0x0a, 0x0e}, /* 0 */
621 {0x04, 0x0c, 0x04, 0x04}, /* 1 */
622 {0x0e, 0x02, 0x04, 0x0e}, /* 2 */
623 {0x0e, 0x02, 0x06, 0x0e}, /* 3 */
624 {0x08, 0x0c, 0x0e, 0x04}, /* 4 */
625 {0x0e, 0x0c, 0x02, 0x0c}, /* 5 */
626 {0x0e, 0x08, 0x0e, 0x0e}, /* 6 */
627 {0x0e, 0x02, 0x04, 0x08}, /* 7 */
628 {0x0e, 0x0e, 0x0a, 0x0e}, /* 8 */
629 {0x0e, 0x0e, 0x02, 0x0e} /* 9 */
630 };
631
632 struct wps_state *state = skin_get_global_state();
633 struct screen *display = gwps->display;
634 struct wps_data *data = gwps->data;
635 unsigned char progress_pattern[7];
636 char timestr[10];
637 int time;
638 int time_idx = 0;
639 int pos = 0;
640 int pat_idx = 1;
641 int digit, i, j;
642 bool softchar;
643
644 int elapsed, length;
645 if (LIKELY(state->id3))
646 {
647 elapsed = state->id3->elapsed;
648 length = state->id3->length;
649 }
650 else
651 {
652 elapsed = 0;
653 length = 0;
654 }
655
656 if (buf_size < 34) /* worst case: 11x UTF-8 char + \0 */
657 return;
658
659 time = elapsed + state->ff_rewind_count;
660 if (length)
661 pos = 55 * time / length;
662
663 memset(timestr, 0, sizeof(timestr));
664 format_time(timestr, sizeof(timestr)-2, time);
665 timestr[strlen(timestr)] = ':'; /* always safe */
666
667 for (i = 0; i < 11; i++, pos -= 5)
668 {
669 softchar = false;
670 memset(progress_pattern, 0, sizeof(progress_pattern));
671
672 if ((digit = timestr[time_idx]))
673 {
674 softchar = true;
675 digit -= '0';
676
677 if (timestr[time_idx + 1] == ':') /* ones, left aligned */
678 {
679 memcpy(progress_pattern, numbers[digit], 4);
680 time_idx += 2;
681 }
682 else /* tens, shifted right */
683 {
684 for (j = 0; j < 4; j++)
685 progress_pattern[j] = numbers[digit][j] >> 1;
686
687 if (time_idx > 0) /* not the first group, add colon in front */
688 {
689 progress_pattern[1] |= 0x10u;
690 progress_pattern[3] |= 0x10u;
691 }
692 time_idx++;
693 }
694
695 if (pos >= 5)
696 progress_pattern[5] = progress_pattern[6] = 0x1fu;
697 }
698
699 if (pos > 0 && pos < 5)
700 {
701 softchar = true;
702 progress_pattern[5] = progress_pattern[6] = (~0x1fu >> pos) & 0x1fu;
703 }
704
705 if (softchar && pat_idx < 8)
706 {
707 display->define_pattern(data->wps_progress_pat[pat_idx],
708 progress_pattern);
709 buf = utf8encode(data->wps_progress_pat[pat_idx], buf);
710 pat_idx++;
711 }
712 else if (pos <= 0)
713 buf = utf8encode(' ', buf);
714 else
715 buf = utf8encode(0xe115, buf); /* 2/7 _ */
716 }
717 *buf = '\0';
718}
719
720#endif /* HAVE_LCD_CHARCELLS */
721
722/* Don't inline this; it was broken out of get_token_value to reduce stack 577/* Don't inline this; it was broken out of get_token_value to reduce stack
723 * usage. 578 * usage.
724 */ 579 */
@@ -1351,34 +1206,6 @@ const char *get_token_value(struct gui_wps *gwps,
1351 return "-"; 1206 return "-";
1352#endif 1207#endif
1353 1208
1354#ifdef HAVE_LCD_CHARCELLS
1355 case SKIN_TOKEN_PROGRESSBAR:
1356 {
1357 char *end;
1358 format_player_progress(gwps);
1359 end = utf8encode(data->wps_progress_pat[0], buf);
1360 *end = '\0';
1361 return buf;
1362 }
1363
1364 case SKIN_TOKEN_PLAYER_PROGRESSBAR:
1365 if(is_new_player())
1366 {
1367 /* we need 11 characters (full line) for
1368 progress-bar */
1369 strlcpy(buf, " ", buf_size);
1370 format_player_fullbar(gwps,buf,buf_size);
1371 DEBUGF("bar='%s'\n",buf);
1372 }
1373 else
1374 {
1375 /* Tell the user if we have an OldPlayer */
1376 strlcpy(buf, " <Old LCD> ", buf_size);
1377 }
1378 return buf;
1379#endif
1380
1381
1382#ifdef HAVE_LCD_BITMAP 1209#ifdef HAVE_LCD_BITMAP
1383 /* peakmeter */ 1210 /* peakmeter */
1384 case SKIN_TOKEN_PEAKMETER_LEFT: 1211 case SKIN_TOKEN_PEAKMETER_LEFT: