summaryrefslogtreecommitdiff
path: root/apps/plugins/lrcplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lrcplayer.c')
-rw-r--r--apps/plugins/lrcplayer.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c
index eb441eab8d..1b017942a9 100644
--- a/apps/plugins/lrcplayer.c
+++ b/apps/plugins/lrcplayer.c
@@ -144,11 +144,7 @@ static struct viewport vp_lyrics[NB_SCREENS];
144 144
145#include "lib/pluginlib_actions.h" 145#include "lib/pluginlib_actions.h"
146#define LST_SET_TIME (LST_SET_MSEC|LST_SET_SEC|LST_SET_MIN|LST_SET_HOUR) 146#define LST_SET_TIME (LST_SET_MSEC|LST_SET_SEC|LST_SET_MIN|LST_SET_HOUR)
147#ifdef HAVE_LCD_CHARCELLS
148#define LST_OFF_Y 0
149#else /* HAVE_LCD_BITMAP */
150#define LST_OFF_Y 1 147#define LST_OFF_Y 1
151#endif
152static int lrc_set_time(const char *title, const char *unit, long *pval, 148static int lrc_set_time(const char *title, const char *unit, long *pval,
153 int step, int min, int max, int flags) 149 int step, int min, int max, int flags)
154{ 150{
@@ -229,17 +225,11 @@ static int lrc_set_time(const char *title, const char *unit, long *pval,
229 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 225 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
230 rb->lcd_putsxy(x, y*(1+LST_OFF_Y), &buffer[p_start]); 226 rb->lcd_putsxy(x, y*(1+LST_OFF_Y), &buffer[p_start]);
231 rb->lcd_set_drawmode(DRMODE_SOLID); 227 rb->lcd_set_drawmode(DRMODE_SOLID);
232#else
233 rb->lcd_put_cursor(x+rb->utf8length(&buffer[p_start])-1, y, 0x7F);
234#endif 228#endif
235 } 229 }
236 rb->lcd_update(); 230 rb->lcd_update();
237 int button = pluginlib_getaction(TIMEOUT_BLOCK, lst_contexts, ARRAYLEN(lst_contexts)); 231 int button = pluginlib_getaction(TIMEOUT_BLOCK, lst_contexts, ARRAYLEN(lst_contexts));
238 int mult = 1; 232 int mult = 1;
239#ifdef HAVE_LCD_CHARCELLS
240 if (pos_min != pos_max)
241 rb->lcd_remove_cursor();
242#endif
243 switch (button) 233 switch (button)
244 { 234 {
245 case PLA_UP_REPEAT: 235 case PLA_UP_REPEAT:
@@ -452,9 +442,7 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
452 int word_count, word_width; 442 int word_count, word_width;
453 const unsigned char *str; 443 const unsigned char *str;
454 } 444 }
455#ifndef HAVE_LCD_CHARCELLS
456 sp, 445 sp,
457#endif
458 cr; 446 cr;
459 447
460 lrc_buffer_used = (lrc_buffer_used+3)&~3; /* 4 bytes aligned */ 448 lrc_buffer_used = (lrc_buffer_used+3)&~3; /* 4 bytes aligned */
@@ -514,19 +502,15 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
514 cr.nword = lrc_line->nword; 502 cr.nword = lrc_line->nword;
515 lrc_word = lrc_line->words+cr.nword; 503 lrc_word = lrc_line->words+cr.nword;
516 cr.str = (lrc_word-1)->word; 504 cr.str = (lrc_word-1)->word;
517#ifndef HAVE_LCD_CHARCELLS
518 sp.word_count = 0; 505 sp.word_count = 0;
519 sp.word_width = 0; 506 sp.word_width = 0;
520 sp.nword = 0; 507 sp.nword = 0;
521 sp.count = 0; 508 sp.count = 0;
522 sp.width = 0; 509 sp.width = 0;
523#endif
524 do { 510 do {
525 cr.count = 0; 511 cr.count = 0;
526 cr.width = 0; 512 cr.width = 0;
527#ifndef HAVE_LCD_CHARCELLS
528 sp.str = NULL; 513 sp.str = NULL;
529#endif
530 514
531 while (1) 515 while (1)
532 { 516 {
@@ -541,10 +525,6 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
541 break; 525 break;
542 526
543 int c, w; 527 int c, w;
544#ifdef HAVE_LCD_CHARCELLS
545 c = rb->utf8seek(cr.str, 1);
546 w = 1;
547#else
548 c = ((intptr_t)rb->utf8decode(cr.str, &ch) - (intptr_t)cr.str); 528 c = ((intptr_t)rb->utf8decode(cr.str, &ch) - (intptr_t)cr.str);
549 if (rb->is_diacritic(ch, NULL)) 529 if (rb->is_diacritic(ch, NULL))
550 w = 0; 530 w = 0;
@@ -576,7 +556,6 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
576 } 556 }
577 break; 557 break;
578 } 558 }
579#endif
580 cr.count += c; 559 cr.count += c;
581 cr.width += w; 560 cr.width += w;
582 lrc_word->count += c; 561 lrc_word->count += c;
@@ -1916,38 +1895,6 @@ static void display_lrcs(void)
1916 } 1895 }
1917 if (!lrc_line && ypos < vp_lyrics[i].height) 1896 if (!lrc_line && ypos < vp_lyrics[i].height)
1918 display->putsxy(0, ypos, "[end]"); 1897 display->putsxy(0, ypos, "[end]");
1919#else /* HAVE_LCD_CHARCELLS */
1920 struct lrc_line *lrc_line = lrc_center;
1921 struct lrc_brpos *lrc_brpos = calc_brpos(lrc_line, i);
1922 long elapsed = 0;
1923 const char *str = get_lrc_str(lrc_line);
1924 int x = vp_lyrics[i].width/2, y = 0;
1925
1926 if (rin >= 0 && len > 0)
1927 {
1928 elapsed = rin * lrc_center->width / len;
1929 while (elapsed > lrc_brpos->width)
1930 {
1931 elapsed -= lrc_brpos->width;
1932 str = lrc_skip_space(str+lrc_brpos->count);
1933 lrc_brpos++;
1934 }
1935 }
1936 rb->strlcpy(temp_buf, str, lrc_brpos->count+1);
1937
1938 x -= elapsed;
1939 if (x < 0)
1940 display->puts(0, y, temp_buf + rb->utf8seek(temp_buf, -x));
1941 else
1942 display->puts(x, y, temp_buf);
1943 x += rb->utf8length(temp_buf)+1;
1944 lrc_line = lrc_line->next;
1945 if (!lrc_line && x < vp_lyrics[i].width)
1946 {
1947 if (x < vp_lyrics[i].width/2)
1948 x = vp_lyrics[i].width/2;
1949 display->puts(x, y, "[end]");
1950 }
1951#endif /* HAVE_LCD_BITMAP */ 1898#endif /* HAVE_LCD_BITMAP */
1952 display->update_viewport(); 1899 display->update_viewport();
1953 display->set_viewport(NULL); 1900 display->set_viewport(NULL);