diff options
-rw-r--r-- | apps/screens.c | 135 | ||||
-rw-r--r-- | apps/wps-display.c | 31 | ||||
-rw-r--r-- | apps/wps-display.h | 1 |
3 files changed, 90 insertions, 77 deletions
diff --git a/apps/screens.c b/apps/screens.c index 6d9b299c54..20e4ceac02 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -40,11 +40,12 @@ | |||
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 | #include "id3.h" |
44 | #include "screens.h" | 44 | #include "screens.h" |
45 | #include "debug.h" | 45 | #include "debug.h" |
46 | #include "led.h" | 46 | #include "led.h" |
47 | #include "sound.h" | 47 | #include "sound.h" |
48 | #include "wps-display.h" | ||
48 | #ifdef HAVE_MMC | 49 | #ifdef HAVE_MMC |
49 | #include "ata_mmc.h" | 50 | #include "ata_mmc.h" |
50 | #endif | 51 | #endif |
@@ -60,7 +61,7 @@ static const unsigned char usb_logo[] = { | |||
60 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x81, 0x81, 0x81, | 61 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x81, 0x81, 0x81, |
61 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | 62 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
62 | 0x01, 0x01, 0x01, 0x01, 0xf1, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, | 63 | 0x01, 0x01, 0x01, 0x01, 0xf1, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, |
63 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, | 64 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, |
64 | 0x00, 0x00, 0xe0, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | 65 | 0x00, 0x00, 0xe0, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, |
65 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | 66 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, |
66 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x81, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, | 67 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x81, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, |
@@ -68,7 +69,7 @@ static const unsigned char usb_logo[] = { | |||
68 | 0x0c, 0x0e, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, | 69 | 0x0c, 0x0e, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, |
69 | 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, | 70 | 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, |
70 | 0x00, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, | 71 | 0x00, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, |
71 | 0x02, 0x02, 0x02, 0x82, 0x7e, 0x00, 0xc0, 0x3e, 0x01, | 72 | 0x02, 0x02, 0x02, 0x82, 0x7e, 0x00, 0xc0, 0x3e, 0x01, |
72 | 0x70, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, | 73 | 0x70, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, |
73 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, | 74 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, |
74 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x07, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, | 75 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x07, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, |
@@ -76,7 +77,7 @@ static const unsigned char usb_logo[] = { | |||
76 | 0x1f, 0x3f, 0x7b, 0xf3, 0xe3, 0xc3, 0x83, 0x83, 0x83, 0x83, 0xe3, 0xe3, 0xe3, | 77 | 0x1f, 0x3f, 0x7b, 0xf3, 0xe3, 0xc3, 0x83, 0x83, 0x83, 0x83, 0xe3, 0xe3, 0xe3, |
77 | 0xe3, 0xe3, 0xe3, 0x03, 0x03, 0x03, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x02, | 78 | 0xe3, 0xe3, 0xe3, 0x03, 0x03, 0x03, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x02, |
78 | 0xc0, 0x3e, 0x01, 0xe0, 0x9f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, | 79 | 0xc0, 0x3e, 0x01, 0xe0, 0x9f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
79 | 0x80, 0x80, 0xf0, 0x0f, 0x80, 0x78, 0x07, 0x00, 0x00, | 80 | 0x80, 0x80, 0xf0, 0x0f, 0x80, 0x78, 0x07, 0x00, 0x00, |
80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, | 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, |
@@ -84,7 +85,7 @@ static const unsigned char usb_logo[] = { | |||
84 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x87, 0x87, 0x87, | 85 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x87, 0x87, 0x87, |
85 | 0x87, 0x87, 0x87, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, | 86 | 0x87, 0x87, 0x87, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, |
86 | 0x0f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | 87 | 0x0f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, |
87 | 0x04, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, | 88 | 0x04, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, |
88 | }; | 89 | }; |
89 | #endif | 90 | #endif |
90 | 91 | ||
@@ -148,7 +149,7 @@ int mmc_remove_request(void) | |||
148 | splash(1, true, str(LANG_REMOVE_MMC)); | 149 | splash(1, true, str(LANG_REMOVE_MMC)); |
149 | if (global_settings.talk_menu) | 150 | if (global_settings.talk_menu) |
150 | talk_id(LANG_REMOVE_MMC, false); | 151 | talk_id(LANG_REMOVE_MMC, false); |
151 | 152 | ||
152 | while (1) | 153 | while (1) |
153 | { | 154 | { |
154 | queue_wait_w_tmo(&button_queue, &ev, HZ/2); | 155 | queue_wait_w_tmo(&button_queue, &ev, HZ/2); |
@@ -156,7 +157,7 @@ int mmc_remove_request(void) | |||
156 | { | 157 | { |
157 | case SYS_MMC_EXTRACTED: | 158 | case SYS_MMC_EXTRACTED: |
158 | return SYS_MMC_EXTRACTED; | 159 | return SYS_MMC_EXTRACTED; |
159 | 160 | ||
160 | case SYS_USB_DISCONNECTED: | 161 | case SYS_USB_DISCONNECTED: |
161 | return SYS_USB_DISCONNECTED; | 162 | return SYS_USB_DISCONNECTED; |
162 | } | 163 | } |
@@ -223,20 +224,20 @@ void charging_display_info(bool animate) | |||
223 | animate = false; | 224 | animate = false; |
224 | #endif /* HAVE_CHARGE_CTRL */ | 225 | #endif /* HAVE_CHARGE_CTRL */ |
225 | 226 | ||
226 | 227 | ||
227 | /* middle part */ | 228 | /* middle part */ |
228 | memset(charging_logo+3, 0x00, 32); | 229 | memset(charging_logo+3, 0x00, 32); |
229 | charging_logo[0] = 0x3C; | 230 | charging_logo[0] = 0x3C; |
230 | charging_logo[1] = 0x24; | 231 | charging_logo[1] = 0x24; |
231 | charging_logo[2] = charging_logo[35] = 0xFF; | 232 | charging_logo[2] = charging_logo[35] = 0xFF; |
232 | 233 | ||
233 | if (!animate) | 234 | if (!animate) |
234 | { /* draw the outline */ | 235 | { /* draw the outline */ |
235 | /* middle part */ | 236 | /* middle part */ |
236 | lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8); | 237 | lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8); |
237 | lcd_set_drawmode(DRMODE_FG); | 238 | lcd_set_drawmode(DRMODE_FG); |
238 | /* upper line */ | 239 | /* upper line */ |
239 | charging_logo[0] = charging_logo[1] = 0x00; | 240 | charging_logo[0] = charging_logo[1] = 0x00; |
240 | memset(charging_logo+2, 0x80, 34); | 241 | memset(charging_logo+2, 0x80, 34); |
241 | lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8); | 242 | lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8); |
242 | /* lower line */ | 243 | /* lower line */ |
@@ -252,7 +253,7 @@ void charging_display_info(bool animate) | |||
252 | { /* draw a "bubble" here */ | 253 | { /* draw a "bubble" here */ |
253 | unsigned bitpos; | 254 | unsigned bitpos; |
254 | bitpos = (phase + i/8) % 15; /* "bounce" effect */ | 255 | bitpos = (phase + i/8) % 15; /* "bounce" effect */ |
255 | if (bitpos > 7) | 256 | if (bitpos > 7) |
256 | bitpos = 14 - bitpos; | 257 | bitpos = 14 - bitpos; |
257 | charging_logo[i] = 0x01 << bitpos; | 258 | charging_logo[i] = 0x01 << bitpos; |
258 | } | 259 | } |
@@ -274,7 +275,7 @@ static const unsigned char logo_pattern[] = { | |||
274 | 275 | ||
275 | static void logo_lock_patterns(bool on) | 276 | static void logo_lock_patterns(bool on) |
276 | { | 277 | { |
277 | int i; | 278 | int i; |
278 | 279 | ||
279 | if (on) | 280 | if (on) |
280 | { | 281 | { |
@@ -301,7 +302,7 @@ void charging_display_info(bool animate) | |||
301 | snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars, | 302 | snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars, |
302 | battery_voltage / 100, battery_voltage % 100); | 303 | battery_voltage / 100, battery_voltage % 100); |
303 | lcd_puts(0, 1, buf); | 304 | lcd_puts(0, 1, buf); |
304 | 305 | ||
305 | memcpy(buf, logo_pattern, 28); /* copy logo patterns */ | 306 | memcpy(buf, logo_pattern, 28); /* copy logo patterns */ |
306 | 307 | ||
307 | if (!animate) /* build the screen */ | 308 | if (!animate) /* build the screen */ |
@@ -323,7 +324,7 @@ void charging_display_info(bool animate) | |||
323 | } | 324 | } |
324 | phase++; | 325 | phase++; |
325 | } | 326 | } |
326 | 327 | ||
327 | for (i = 0; i < 4; i++) | 328 | for (i = 0; i < 4; i++) |
328 | lcd_define_pattern(logo_chars[i], buf + 7 * i); | 329 | lcd_define_pattern(logo_chars[i], buf + 7 * i); |
329 | } | 330 | } |
@@ -410,7 +411,7 @@ int pitch_screen(void) | |||
410 | 411 | ||
411 | lcd_clear_display(); | 412 | lcd_clear_display(); |
412 | lcd_setfont(FONT_SYSFIXED); | 413 | lcd_setfont(FONT_SYSFIXED); |
413 | 414 | ||
414 | ptr = str(LANG_PITCH_UP); | 415 | ptr = str(LANG_PITCH_UP); |
415 | lcd_getstringsize(ptr,&w,&h); | 416 | lcd_getstringsize(ptr,&w,&h); |
416 | lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); | 417 | lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); |
@@ -528,7 +529,7 @@ bool quick_screen(int context, int button) | |||
528 | int w, h, key; | 529 | int w, h, key; |
529 | char buf[32]; | 530 | char buf[32]; |
530 | int oldrepeat = global_settings.repeat_mode; | 531 | int oldrepeat = global_settings.repeat_mode; |
531 | 532 | ||
532 | /* just to stop compiler warning */ | 533 | /* just to stop compiler warning */ |
533 | context = context; | 534 | context = context; |
534 | lcd_setfont(FONT_SYSFIXED); | 535 | lcd_setfont(FONT_SYSFIXED); |
@@ -551,8 +552,8 @@ bool quick_screen(int context, int button) | |||
551 | /* Shuffle mode */ | 552 | /* Shuffle mode */ |
552 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE)); | 553 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE)); |
553 | lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); | 554 | lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); |
554 | lcd_putsxy(0, LCD_HEIGHT/2, | 555 | lcd_putsxy(0, LCD_HEIGHT/2, |
555 | global_settings.playlist_shuffle ? | 556 | global_settings.playlist_shuffle ? |
556 | str(LANG_ON) : str(LANG_OFF)); | 557 | str(LANG_ON) : str(LANG_OFF)); |
557 | 558 | ||
558 | /* Directory Filter */ | 559 | /* Directory Filter */ |
@@ -560,15 +561,15 @@ bool quick_screen(int context, int button) | |||
560 | case SHOW_ALL: | 561 | case SHOW_ALL: |
561 | ptr = str(LANG_FILTER_ALL); | 562 | ptr = str(LANG_FILTER_ALL); |
562 | break; | 563 | break; |
563 | 564 | ||
564 | case SHOW_SUPPORTED: | 565 | case SHOW_SUPPORTED: |
565 | ptr = str(LANG_FILTER_SUPPORTED); | 566 | ptr = str(LANG_FILTER_SUPPORTED); |
566 | break; | 567 | break; |
567 | 568 | ||
568 | case SHOW_MUSIC: | 569 | case SHOW_MUSIC: |
569 | ptr = str(LANG_FILTER_MUSIC); | 570 | ptr = str(LANG_FILTER_MUSIC); |
570 | break; | 571 | break; |
571 | 572 | ||
572 | case SHOW_PLAYLIST: | 573 | case SHOW_PLAYLIST: |
573 | ptr = str(LANG_FILTER_PLAYLIST); | 574 | ptr = str(LANG_FILTER_PLAYLIST); |
574 | break; | 575 | break; |
@@ -577,7 +578,7 @@ bool quick_screen(int context, int button) | |||
577 | ptr = str(LANG_FILTER_ID3DB); | 578 | ptr = str(LANG_FILTER_ID3DB); |
578 | break; | 579 | break; |
579 | } | 580 | } |
580 | 581 | ||
581 | snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER)); | 582 | snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER)); |
582 | lcd_getstringsize(buf,&w,&h); | 583 | lcd_getstringsize(buf,&w,&h); |
583 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); | 584 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); |
@@ -589,20 +590,20 @@ bool quick_screen(int context, int button) | |||
589 | case REPEAT_OFF: | 590 | case REPEAT_OFF: |
590 | ptr = str(LANG_OFF); | 591 | ptr = str(LANG_OFF); |
591 | break; | 592 | break; |
592 | 593 | ||
593 | case REPEAT_ALL: | 594 | case REPEAT_ALL: |
594 | ptr = str(LANG_REPEAT_ALL); | 595 | ptr = str(LANG_REPEAT_ALL); |
595 | break; | 596 | break; |
596 | 597 | ||
597 | case REPEAT_ONE: | 598 | case REPEAT_ONE: |
598 | ptr = str(LANG_REPEAT_ONE); | 599 | ptr = str(LANG_REPEAT_ONE); |
599 | break; | 600 | break; |
600 | 601 | ||
601 | case REPEAT_SHUFFLE: | 602 | case REPEAT_SHUFFLE: |
602 | ptr = str(LANG_SHUFFLE); | 603 | ptr = str(LANG_SHUFFLE); |
603 | break; | 604 | break; |
604 | } | 605 | } |
605 | 606 | ||
606 | lcd_getstringsize(str(LANG_SHUFFLE),&w,&h); | 607 | lcd_getstringsize(str(LANG_SHUFFLE),&w,&h); |
607 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT)); | 608 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT)); |
608 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); | 609 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); |
@@ -613,17 +614,17 @@ bool quick_screen(int context, int button) | |||
613 | /* Scrollbar */ | 614 | /* Scrollbar */ |
614 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL)); | 615 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL)); |
615 | lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR)); | 616 | lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR)); |
616 | lcd_putsxy(0, LCD_HEIGHT/2, | 617 | lcd_putsxy(0, LCD_HEIGHT/2, |
617 | global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF)); | 618 | global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF)); |
618 | 619 | ||
619 | /* Status bar */ | 620 | /* Status bar */ |
620 | ptr = str(LANG_F3_STATUS); | 621 | ptr = str(LANG_F3_STATUS); |
621 | lcd_getstringsize(ptr,&w,&h); | 622 | lcd_getstringsize(ptr,&w,&h); |
622 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr); | 623 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr); |
623 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR)); | 624 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR)); |
624 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, | 625 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, |
625 | global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF)); | 626 | global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF)); |
626 | 627 | ||
627 | /* Flip */ | 628 | /* Flip */ |
628 | ptr = str(LANG_FLIP_DISPLAY); | 629 | ptr = str(LANG_FLIP_DISPLAY); |
629 | lcd_getstringsize(ptr,&w,&h); | 630 | lcd_getstringsize(ptr,&w,&h); |
@@ -636,7 +637,7 @@ bool quick_screen(int context, int button) | |||
636 | #endif | 637 | #endif |
637 | } | 638 | } |
638 | 639 | ||
639 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], | 640 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], |
640 | LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); | 641 | LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); |
641 | lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], | 642 | lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], |
642 | LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); | 643 | LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); |
@@ -645,15 +646,15 @@ bool quick_screen(int context, int button) | |||
645 | 646 | ||
646 | lcd_update(); | 647 | lcd_update(); |
647 | key = button_get(true); | 648 | key = button_get(true); |
648 | 649 | ||
649 | /* | 650 | /* |
650 | * This is a temporary kludge so that the F2 & F3 menus operate in exactly | 651 | * This is a temporary kludge so that the F2 & F3 menus operate in exactly |
651 | * the same manner up until the full F2/F3 configurable menus are complete | 652 | * the same manner up until the full F2/F3 configurable menus are complete |
652 | */ | 653 | */ |
653 | 654 | ||
654 | if( key == BUTTON_LEFT || key == BUTTON_RIGHT || key == BUTTON_DOWN || key == ( BUTTON_LEFT | BUTTON_REPEAT ) || key == ( BUTTON_RIGHT | BUTTON_REPEAT ) || key == ( BUTTON_DOWN | BUTTON_REPEAT ) ) | 655 | if( key == BUTTON_LEFT || key == BUTTON_RIGHT || key == BUTTON_DOWN || key == ( BUTTON_LEFT | BUTTON_REPEAT ) || key == ( BUTTON_RIGHT | BUTTON_REPEAT ) || key == ( BUTTON_DOWN | BUTTON_REPEAT ) ) |
655 | key = button | key; | 656 | key = button | key; |
656 | 657 | ||
657 | switch (key) { | 658 | switch (key) { |
658 | case SCREENS_QUICK | BUTTON_LEFT: | 659 | case SCREENS_QUICK | BUTTON_LEFT: |
659 | case SCREENS_QUICK | BUTTON_LEFT | BUTTON_REPEAT: | 660 | case SCREENS_QUICK | BUTTON_LEFT | BUTTON_REPEAT: |
@@ -712,12 +713,12 @@ bool quick_screen(int context, int button) | |||
712 | case BUTTON_F3 | BUTTON_REL: | 713 | case BUTTON_F3 | BUTTON_REL: |
713 | #endif | 714 | #endif |
714 | case SCREENS_QUICK | BUTTON_REL: | 715 | case SCREENS_QUICK | BUTTON_REL: |
715 | 716 | ||
716 | if( used ) | 717 | if( used ) |
717 | exit = true; | 718 | exit = true; |
718 | 719 | ||
719 | used = true; | 720 | used = true; |
720 | 721 | ||
721 | break; | 722 | break; |
722 | 723 | ||
723 | case BUTTON_OFF | BUTTON_REL: | 724 | case BUTTON_OFF | BUTTON_REL: |
@@ -732,7 +733,7 @@ bool quick_screen(int context, int button) | |||
732 | } | 733 | } |
733 | 734 | ||
734 | settings_save(); | 735 | settings_save(); |
735 | 736 | ||
736 | switch( button ) | 737 | switch( button ) |
737 | { | 738 | { |
738 | case SCREENS_QUICK: | 739 | case SCREENS_QUICK: |
@@ -748,11 +749,11 @@ bool quick_screen(int context, int button) | |||
748 | lcd_setmargins(0, STATUSBAR_HEIGHT); | 749 | lcd_setmargins(0, STATUSBAR_HEIGHT); |
749 | else | 750 | else |
750 | lcd_setmargins(0, 0); | 751 | lcd_setmargins(0, 0); |
751 | 752 | ||
752 | break; | 753 | break; |
753 | #endif | 754 | #endif |
754 | } | 755 | } |
755 | 756 | ||
756 | lcd_setfont(FONT_UI); | 757 | lcd_setfont(FONT_UI); |
757 | 758 | ||
758 | return false; | 759 | return false; |
@@ -794,13 +795,13 @@ void splash(int ticks, /* how long the splash is displayed */ | |||
794 | #endif | 795 | #endif |
795 | 796 | ||
796 | #ifdef HAVE_LCD_CHARCELLS | 797 | #ifdef HAVE_LCD_CHARCELLS |
797 | lcd_double_height (false); | 798 | lcd_double_height (false); |
798 | #endif | 799 | #endif |
799 | va_start( ap, fmt ); | 800 | va_start( ap, fmt ); |
800 | vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); | 801 | vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); |
801 | 802 | ||
802 | if(center) { | 803 | if(center) { |
803 | 804 | ||
804 | /* first a pass to measure sizes */ | 805 | /* first a pass to measure sizes */ |
805 | next = strtok_r(splash_buf, " ", &store); | 806 | next = strtok_r(splash_buf, " ", &store); |
806 | while (next) { | 807 | while (next) { |
@@ -965,7 +966,7 @@ static void say_time(int cursorpos, const struct tm *tm) | |||
965 | value = tm->tm_mday; | 966 | value = tm->tm_mday; |
966 | break; | 967 | break; |
967 | } | 968 | } |
968 | 969 | ||
969 | if (cursorpos == 4) /* month */ | 970 | if (cursorpos == 4) /* month */ |
970 | talk_id(LANG_MONTH_JANUARY + tm->tm_mon, false); | 971 | talk_id(LANG_MONTH_JANUARY + tm->tm_mon, false); |
971 | else | 972 | else |
@@ -1019,7 +1020,7 @@ bool set_time_screen(const char* string, struct tm *tm) | |||
1019 | char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, | 1020 | char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, |
1020 | {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; | 1021 | {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; |
1021 | char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | 1022 | char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
1022 | 1023 | ||
1023 | int monthname_len = 0, dayname_len = 0; | 1024 | int monthname_len = 0, dayname_len = 0; |
1024 | 1025 | ||
1025 | int *valptr = NULL; | 1026 | int *valptr = NULL; |
@@ -1205,7 +1206,7 @@ bool set_time_screen(const char* string, struct tm *tm) | |||
1205 | break; | 1206 | break; |
1206 | case BUTTON_DOWN: | 1207 | case BUTTON_DOWN: |
1207 | case BUTTON_DOWN | BUTTON_REPEAT: | 1208 | case BUTTON_DOWN | BUTTON_REPEAT: |
1208 | *valptr = (*valptr + steps - min - 1) % | 1209 | *valptr = (*valptr + steps - min - 1) % |
1209 | steps + min; | 1210 | steps + min; |
1210 | if(*valptr == 0) | 1211 | if(*valptr == 0) |
1211 | *valptr = min; | 1212 | *valptr = min; |
@@ -1259,7 +1260,7 @@ bool shutdown_screen(void) | |||
1259 | default: | 1260 | default: |
1260 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 1261 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
1261 | return true; | 1262 | return true; |
1262 | 1263 | ||
1263 | /* Return if any other button was pushed, or if there | 1264 | /* Return if any other button was pushed, or if there |
1264 | was a timeout. We ignore RELEASE events, since we may | 1265 | was a timeout. We ignore RELEASE events, since we may |
1265 | have been called by a button down event, and the user might | 1266 | have been called by a button down event, and the user might |
@@ -1295,27 +1296,30 @@ bool browse_id3(void) | |||
1295 | { | 1296 | { |
1296 | case 0: | 1297 | case 0: |
1297 | lcd_puts(0, 0, str(LANG_ID3_TITLE)); | 1298 | lcd_puts(0, 0, str(LANG_ID3_TITLE)); |
1298 | lcd_puts_scroll(0, 1, id3->title ? id3->title : | 1299 | lcd_puts_scroll(0, 1, id3->title ? id3->title : |
1299 | (char*)str(LANG_ID3_NO_TITLE)); | 1300 | (char*)str(LANG_ID3_NO_TITLE)); |
1300 | break; | 1301 | break; |
1301 | 1302 | ||
1302 | case 1: | 1303 | case 1: |
1303 | lcd_puts(0, 0, str(LANG_ID3_ARTIST)); | 1304 | lcd_puts(0, 0, str(LANG_ID3_ARTIST)); |
1304 | lcd_puts_scroll(0, 1, | 1305 | lcd_puts_scroll(0, 1, |
1305 | id3->artist ? id3->artist : | 1306 | id3->artist ? id3->artist : |
1306 | (char*)str(LANG_ID3_NO_ARTIST)); | 1307 | (char*)str(LANG_ID3_NO_ARTIST)); |
1307 | break; | 1308 | break; |
1308 | 1309 | ||
1309 | case 2: | 1310 | case 2: |
1310 | lcd_puts(0, 0, str(LANG_ID3_ALBUM)); | 1311 | lcd_puts(0, 0, str(LANG_ID3_ALBUM)); |
1311 | lcd_puts_scroll(0, 1, id3->album ? id3->album : | 1312 | lcd_puts_scroll(0, 1, id3->album ? id3->album : |
1312 | (char*)str(LANG_ID3_NO_ALBUM)); | 1313 | (char*)str(LANG_ID3_NO_ALBUM)); |
1313 | break; | 1314 | break; |
1314 | 1315 | ||
1315 | case 3: | 1316 | case 3: |
1316 | lcd_puts(0, 0, str(LANG_ID3_TRACKNUM)); | 1317 | lcd_puts(0, 0, str(LANG_ID3_TRACKNUM)); |
1317 | 1318 | ||
1318 | if (id3->tracknum) { | 1319 | if (id3->track_string) { |
1320 | lcd_puts_scroll(0, 1, id3->track_string); | ||
1321 | } | ||
1322 | else if (id3->tracknum) { | ||
1319 | snprintf(scroll_text,sizeof(scroll_text), "%d", | 1323 | snprintf(scroll_text,sizeof(scroll_text), "%d", |
1320 | id3->tracknum); | 1324 | id3->tracknum); |
1321 | lcd_puts_scroll(0, 1, scroll_text); | 1325 | lcd_puts_scroll(0, 1, scroll_text); |
@@ -1326,15 +1330,24 @@ bool browse_id3(void) | |||
1326 | 1330 | ||
1327 | case 4: | 1331 | case 4: |
1328 | lcd_puts(0, 0, str(LANG_ID3_GENRE)); | 1332 | lcd_puts(0, 0, str(LANG_ID3_GENRE)); |
1329 | lcd_puts_scroll(0, 1, | 1333 | |
1330 | id3_get_genre(id3) ? | 1334 | if (id3->genre_string) { |
1331 | id3_get_genre(id3) : | 1335 | lcd_puts_scroll(0, 1, id3->genre_string); |
1332 | (char*)str(LANG_ID3_NO_INFO)); | 1336 | } |
1337 | else { | ||
1338 | lcd_puts_scroll(0, 1, | ||
1339 | id3_get_genre(id3) ? | ||
1340 | id3_get_genre(id3) : | ||
1341 | (char*)str(LANG_ID3_NO_INFO)); | ||
1342 | } | ||
1333 | break; | 1343 | break; |
1334 | 1344 | ||
1335 | case 5: | 1345 | case 5: |
1336 | lcd_puts(0, 0, str(LANG_ID3_YEAR)); | 1346 | lcd_puts(0, 0, str(LANG_ID3_YEAR)); |
1337 | if (id3->year) { | 1347 | if (id3->year_string) { |
1348 | lcd_puts_scroll(0, 1, id3->year_string); | ||
1349 | } | ||
1350 | else if (id3->year) { | ||
1338 | snprintf(scroll_text,sizeof(scroll_text), "%d", | 1351 | snprintf(scroll_text,sizeof(scroll_text), "%d", |
1339 | id3->year); | 1352 | id3->year); |
1340 | lcd_puts_scroll(0, 1, scroll_text); | 1353 | lcd_puts_scroll(0, 1, scroll_text); |
@@ -1345,9 +1358,7 @@ bool browse_id3(void) | |||
1345 | 1358 | ||
1346 | case 6: | 1359 | case 6: |
1347 | lcd_puts(0, 0, str(LANG_ID3_LENGHT)); | 1360 | lcd_puts(0, 0, str(LANG_ID3_LENGHT)); |
1348 | snprintf(scroll_text,sizeof(scroll_text), "%d:%02d", | 1361 | wps_format_time(scroll_text, sizeof(scroll_text), id3->length); |
1349 | (int) (id3->length / 60000), | ||
1350 | (int) (id3->length % 60000 / 1000) ); | ||
1351 | lcd_puts(0, 1, scroll_text); | 1362 | lcd_puts(0, 1, scroll_text); |
1352 | break; | 1363 | break; |
1353 | 1364 | ||
@@ -1361,7 +1372,7 @@ bool browse_id3(void) | |||
1361 | 1372 | ||
1362 | case 8: | 1373 | case 8: |
1363 | lcd_puts(0, 0, str(LANG_ID3_BITRATE)); | 1374 | lcd_puts(0, 0, str(LANG_ID3_BITRATE)); |
1364 | snprintf(scroll_text,sizeof(scroll_text), "%d kbps", | 1375 | snprintf(scroll_text,sizeof(scroll_text), "%d kbps", |
1365 | id3->bitrate); | 1376 | id3->bitrate); |
1366 | lcd_puts(0, 1, scroll_text); | 1377 | lcd_puts(0, 1, scroll_text); |
1367 | break; | 1378 | break; |
diff --git a/apps/wps-display.c b/apps/wps-display.c index 10a4ca045f..71f88672ec 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c | |||
@@ -225,7 +225,7 @@ bool wps_load(const char* file, bool display) | |||
225 | /* reset image buffer */ | 225 | /* reset image buffer */ |
226 | img_buf_ptr = img_buf; | 226 | img_buf_ptr = img_buf; |
227 | img_buf_free = IMG_BUFSIZE; | 227 | img_buf_free = IMG_BUFSIZE; |
228 | 228 | ||
229 | /* set images to unloaded */ | 229 | /* set images to unloaded */ |
230 | for (i = 0; i < MAX_IMAGES; i++) { | 230 | for (i = 0; i < MAX_IMAGES; i++) { |
231 | img[i].loaded = false; | 231 | img[i].loaded = false; |
@@ -263,9 +263,9 @@ bool wps_load(const char* file, bool display) | |||
263 | } | 263 | } |
264 | if (any_defined_line) | 264 | if (any_defined_line) |
265 | { | 265 | { |
266 | #ifdef HAVE_LCD_BITMAP | 266 | #ifdef HAVE_LCD_BITMAP |
267 | wps_display_images(); | 267 | wps_display_images(); |
268 | #endif | 268 | #endif |
269 | lcd_update(); | 269 | lcd_update(); |
270 | sleep(HZ/2); | 270 | sleep(HZ/2); |
271 | } | 271 | } |
@@ -285,7 +285,7 @@ bool wps_load(const char* file, bool display) | |||
285 | * buf_size - size of buffer. | 285 | * buf_size - size of buffer. |
286 | * time - time to format, in milliseconds. | 286 | * time - time to format, in milliseconds. |
287 | */ | 287 | */ |
288 | static void format_time(char* buf, int buf_size, long time) | 288 | void wps_format_time(char* buf, int buf_size, long time) |
289 | { | 289 | { |
290 | if ( time < 3600000 ) { | 290 | if ( time < 3600000 ) { |
291 | snprintf(buf, buf_size, "%d:%02d", | 291 | snprintf(buf, buf_size, "%d:%02d", |
@@ -544,18 +544,19 @@ static char* get_tag(struct mp3entry* cid3, | |||
544 | 544 | ||
545 | case 'c': /* Current Time in Song */ | 545 | case 'c': /* Current Time in Song */ |
546 | *flags |= WPS_REFRESH_DYNAMIC; | 546 | *flags |= WPS_REFRESH_DYNAMIC; |
547 | format_time(buf, buf_size, id3->elapsed + ff_rewind_count); | 547 | wps_format_time(buf, buf_size, |
548 | id3->elapsed + ff_rewind_count); | ||
548 | return buf; | 549 | return buf; |
549 | 550 | ||
550 | case 'r': /* Remaining Time in Song */ | 551 | case 'r': /* Remaining Time in Song */ |
551 | *flags |= WPS_REFRESH_DYNAMIC; | 552 | *flags |= WPS_REFRESH_DYNAMIC; |
552 | format_time(buf, buf_size, | 553 | wps_format_time(buf, buf_size, |
553 | id3->length - id3->elapsed - ff_rewind_count); | 554 | id3->length - id3->elapsed - ff_rewind_count); |
554 | return buf; | 555 | return buf; |
555 | 556 | ||
556 | case 't': /* Total Time */ | 557 | case 't': /* Total Time */ |
557 | *flags |= WPS_REFRESH_STATIC; | 558 | *flags |= WPS_REFRESH_STATIC; |
558 | format_time(buf, buf_size, id3->length); | 559 | wps_format_time(buf, buf_size, id3->length); |
559 | return buf; | 560 | return buf; |
560 | 561 | ||
561 | #ifdef HAVE_LCD_BITMAP | 562 | #ifdef HAVE_LCD_BITMAP |
@@ -767,7 +768,7 @@ static void format_display(char* buf, | |||
767 | char* value = NULL; | 768 | char* value = NULL; |
768 | int level = 0; | 769 | int level = 0; |
769 | unsigned char tag_length; | 770 | unsigned char tag_length; |
770 | 771 | ||
771 | /* needed for images (ifdef is to kill a warning on player)*/ | 772 | /* needed for images (ifdef is to kill a warning on player)*/ |
772 | int n; | 773 | int n; |
773 | #ifdef HAVE_LCD_BITMAP | 774 | #ifdef HAVE_LCD_BITMAP |
@@ -823,7 +824,7 @@ static void format_display(char* buf, | |||
823 | temp_buf[pos - ptr] = 0; | 824 | temp_buf[pos - ptr] = 0; |
824 | n = atoi(temp_buf); | 825 | n = atoi(temp_buf); |
825 | ptr = pos+1; | 826 | ptr = pos+1; |
826 | 827 | ||
827 | /* check image number, and load state. */ | 828 | /* check image number, and load state. */ |
828 | if ((n < MAX_IMAGES) && (!img[n].loaded)) { | 829 | if ((n < MAX_IMAGES) && (!img[n].loaded)) { |
829 | /* Get filename */ | 830 | /* Get filename */ |
@@ -862,7 +863,7 @@ static void format_display(char* buf, | |||
862 | else | 863 | else |
863 | /* weird syntax, get out */ | 864 | /* weird syntax, get out */ |
864 | break; | 865 | break; |
865 | 866 | ||
866 | /* and load the image */ | 867 | /* and load the image */ |
867 | ret = read_bmp_file(imgname, &img[n].w, &img[n].h, img_buf_ptr, | 868 | ret = read_bmp_file(imgname, &img[n].w, &img[n].h, img_buf_ptr, |
868 | img_buf_free); | 869 | img_buf_free); |
@@ -887,7 +888,7 @@ static void format_display(char* buf, | |||
887 | } | 888 | } |
888 | fmt++; | 889 | fmt++; |
889 | break; | 890 | break; |
890 | 891 | ||
891 | 892 | ||
892 | case '%': | 893 | case '%': |
893 | case '|': | 894 | case '|': |
@@ -1068,7 +1069,7 @@ bool wps_refresh(struct mp3entry* id3, | |||
1068 | #ifdef HAVE_LCD_BITMAP | 1069 | #ifdef HAVE_LCD_BITMAP |
1069 | /* progress */ | 1070 | /* progress */ |
1070 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) { | 1071 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) { |
1071 | scrollbar(0, i*h + offset + 1, LCD_WIDTH, 6, | 1072 | scrollbar(0, i*h + offset + (h > 7 ? (h - 6) / 2 : 1), LCD_WIDTH, 6, |
1072 | id3->length?id3->length:1, 0, | 1073 | id3->length?id3->length:1, 0, |
1073 | id3->length?id3->elapsed + ff_rewind_count:0, | 1074 | id3->length?id3->elapsed + ff_rewind_count:0, |
1074 | HORIZONTAL); | 1075 | HORIZONTAL); |
@@ -1197,7 +1198,7 @@ bool wps_display(struct mp3entry* id3, | |||
1197 | yield(); | 1198 | yield(); |
1198 | wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL); | 1199 | wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL); |
1199 | status_draw(true); | 1200 | status_draw(true); |
1200 | #ifdef HAVE_LCD_BITMAP | 1201 | #ifdef HAVE_LCD_BITMAP |
1201 | wps_display_images(); | 1202 | wps_display_images(); |
1202 | #endif | 1203 | #endif |
1203 | lcd_update(); | 1204 | lcd_update(); |
@@ -1284,7 +1285,7 @@ static void draw_player_fullbar(char* buf, int buf_size, | |||
1284 | time=(id3->elapsed + ff_rewind_count); | 1285 | time=(id3->elapsed + ff_rewind_count); |
1285 | 1286 | ||
1286 | memset(timestr, 0, sizeof(timestr)); | 1287 | memset(timestr, 0, sizeof(timestr)); |
1287 | format_time(timestr, sizeof(timestr), time); | 1288 | wps_format_time(timestr, sizeof(timestr), time); |
1288 | for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) { | 1289 | for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) { |
1289 | digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]); | 1290 | digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]); |
1290 | } | 1291 | } |
diff --git a/apps/wps-display.h b/apps/wps-display.h index 7f7976370a..2c5651fbe2 100644 --- a/apps/wps-display.h +++ b/apps/wps-display.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL) | 33 | #define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL) |
34 | 34 | ||
35 | 35 | ||
36 | void wps_format_time(char* buf, int buf_size, long time); | ||
36 | bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3, | 37 | bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3, |
37 | int ffwd_offset, unsigned char refresh_mode); | 38 | int ffwd_offset, unsigned char refresh_mode); |
38 | bool wps_display(struct mp3entry* id3, struct mp3entry* nid3); | 39 | bool wps_display(struct mp3entry* id3, struct mp3entry* nid3); |