summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/filetree.c4
-rw-r--r--apps/gui/gwps-common.c213
-rw-r--r--apps/gui/gwps-common.h28
-rw-r--r--apps/gui/gwps.c141
-rw-r--r--apps/gui/gwps.h27
-rw-r--r--apps/settings.c12
-rw-r--r--apps/tree.c3
7 files changed, 255 insertions, 173 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 6855d3ec5d..236ee487d7 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -384,7 +384,7 @@ int ft_enter(struct tree_context* c)
384 384
385 /* wps config file */ 385 /* wps config file */
386 case TREE_ATTR_WPS: 386 case TREE_ATTR_WPS:
387 wps_data_load(gui_syncwps.gui_wps[0].data, buf, true, true); 387 wps_data_load(gui_wps[0].data, buf, true, true);
388 set_file(buf, global_settings.wps_file, 388 set_file(buf, global_settings.wps_file,
389 MAX_FILENAME); 389 MAX_FILENAME);
390 break; 390 break;
@@ -392,7 +392,7 @@ int ft_enter(struct tree_context* c)
392#ifdef HAVE_REMOTE_LCD 392#ifdef HAVE_REMOTE_LCD
393 /* remote-wps config file */ 393 /* remote-wps config file */
394 case TREE_ATTR_RWPS: 394 case TREE_ATTR_RWPS:
395 wps_data_load(gui_syncwps.gui_wps[1].data, buf, true, true); 395 wps_data_load(gui_wps[1].data, buf, true, true);
396 set_file(buf, global_settings.rwps_file, 396 set_file(buf, global_settings.rwps_file,
397 MAX_FILENAME); 397 MAX_FILENAME);
398 break; 398 break;
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index d9b40807f7..d24ce05707 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1,3 +1,21 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
1#include "gwps-common.h" 19#include "gwps-common.h"
2#include "gwps.h" 20#include "gwps.h"
3#include "font.h" 21#include "font.h"
@@ -186,7 +204,8 @@ static char* get_tag(struct wps_data* wps_data,
186 return id3_get_genre(id3); 204 return id3_get_genre(id3);
187 205
188 case 'v': /* id3 version */ 206 case 'v': /* id3 version */
189 switch (id3->id3version) { 207 switch (id3->id3version)
208 {
190 case ID3_VER_1_0: 209 case ID3_VER_1_0:
191 return "1"; 210 return "1";
192 211
@@ -275,7 +294,8 @@ static char* get_tag(struct wps_data* wps_data,
275 case 'b': /* progress bar */ 294 case 'b': /* progress bar */
276 *flags |= WPS_REFRESH_PLAYER_PROGRESS; 295 *flags |= WPS_REFRESH_PLAYER_PROGRESS;
277#ifdef HAVE_LCD_CHARCELLS 296#ifdef HAVE_LCD_CHARCELLS
278 snprintf(buf, buf_size, "%c", wps_data->wps_progress_pat[0]); 297 snprintf(buf, buf_size, "%c",
298 wps_data->wps_progress_pat[0]);
279 wps_data->full_line_progressbar=0; 299 wps_data->full_line_progressbar=0;
280 return buf; 300 return buf;
281#else 301#else
@@ -300,7 +320,8 @@ static char* get_tag(struct wps_data* wps_data,
300#endif 320#endif
301 case 'p': /* Playlist Position */ 321 case 'p': /* Playlist Position */
302 *flags |= WPS_REFRESH_STATIC; 322 *flags |= WPS_REFRESH_STATIC;
303 snprintf(buf, buf_size, "%d", playlist_get_display_index()); 323 snprintf(buf, buf_size, "%d",
324 playlist_get_display_index());
304 return buf; 325 return buf;
305 326
306 case 'n': /* Playlist Name (without path) */ 327 case 'n': /* Playlist Name (without path) */
@@ -321,7 +342,8 @@ static char* get_tag(struct wps_data* wps_data,
321 case 'r': /* Remaining Time in Song */ 342 case 'r': /* Remaining Time in Song */
322 *flags |= WPS_REFRESH_DYNAMIC; 343 *flags |= WPS_REFRESH_DYNAMIC;
323 gui_wps_format_time(buf, buf_size, 344 gui_wps_format_time(buf, buf_size,
324 id3->length - id3->elapsed - wps_state.ff_rewind_count); 345 id3->length - id3->elapsed -
346 wps_state.ff_rewind_count);
325 return buf; 347 return buf;
326 348
327 case 't': /* Total Time */ 349 case 't': /* Total Time */
@@ -397,7 +419,8 @@ static char* get_tag(struct wps_data* wps_data,
397 419
398 case 'b': /* battery info */ 420 case 'b': /* battery info */
399 *flags |= WPS_REFRESH_DYNAMIC; 421 *flags |= WPS_REFRESH_DYNAMIC;
400 switch (tag[1]) { 422 switch (tag[1])
423 {
401 case 'l': /* battery level */ 424 case 'l': /* battery level */
402 { 425 {
403 int l = battery_level(); 426 int l = battery_level();
@@ -493,17 +516,17 @@ static char* get_tag(struct wps_data* wps_data,
493 break; 516 break;
494 case 'r': /* Runtime database Information */ 517 case 'r': /* Runtime database Information */
495 switch(tag[1]) 518 switch(tag[1])
496 { 519 {
497 case 'p': /* Playcount */ 520 case 'p': /* Playcount */
498 *flags |= WPS_REFRESH_STATIC; 521 *flags |= WPS_REFRESH_STATIC;
499 snprintf(buf, buf_size, "%ld", cid3->playcount); 522 snprintf(buf, buf_size, "%ld", cid3->playcount);
500 return buf; 523 return buf;
501 case 'r': /* Rating */ 524 case 'r': /* Rating */
502 *flags |= WPS_REFRESH_STATIC; 525 *flags |= WPS_REFRESH_STATIC;
503 *intval = cid3->rating+1; 526 *intval = cid3->rating+1;
504 snprintf(buf, buf_size, "%d", cid3->rating); 527 snprintf(buf, buf_size, "%d", cid3->rating);
505 return buf; 528 return buf;
506 } 529 }
507 break; 530 break;
508 } 531 }
509 return NULL; 532 return NULL;
@@ -513,7 +536,8 @@ static char* get_tag(struct wps_data* wps_data,
513/* clears the area where the image was shown */ 536/* clears the area where the image was shown */
514static void clear_image_pos(struct gui_wps *gwps, int n) 537static void clear_image_pos(struct gui_wps *gwps, int n)
515{ 538{
516 if(!gwps) return; 539 if(!gwps)
540 return;
517 struct wps_data *data = gwps->data; 541 struct wps_data *data = gwps->data;
518 gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 542 gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
519 gwps->display->fillrect(data->img[n].x, data->img[n].y, 543 gwps->display->fillrect(data->img[n].x, data->img[n].y,
@@ -521,6 +545,7 @@ static void clear_image_pos(struct gui_wps *gwps, int n)
521 gwps->display->set_drawmode(DRMODE_SOLID); 545 gwps->display->set_drawmode(DRMODE_SOLID);
522} 546}
523#endif 547#endif
548
524/* Skip to the end of the current %? conditional. 549/* Skip to the end of the current %? conditional.
525 * 550 *
526 * fmt - string to skip it. Should point to somewhere after the leading 551 * fmt - string to skip it. Should point to somewhere after the leading
@@ -529,15 +554,17 @@ static void clear_image_pos(struct gui_wps *gwps, int n)
529 * 554 *
530 * Returns the new position in fmt. 555 * Returns the new position in fmt.
531 */ 556 */
532static const char* skip_conditional(struct gui_wps *gwps, const char* fmt, int num) 557static const char* skip_conditional(struct gui_wps *gwps, const char* fmt,
558 int num)
533{ 559{
534 int level = 1; 560 int level = 1;
535 int count = num; 561 int count = num;
536 const char *last_alternative = NULL; 562 const char *last_alternative = NULL;
537#ifdef HAVE_LCD_BITMAP 563#ifdef HAVE_LCD_BITMAP
538 struct wps_data *data = NULL; 564 struct wps_data *data = NULL;
539 if(gwps) data = gwps->data;
540 int last_x=-1, last_y=-1, last_w=-1, last_h=-1; 565 int last_x=-1, last_y=-1, last_w=-1, last_h=-1;
566 if(gwps)
567 data = gwps->data;
541#else 568#else
542 (void)gwps; 569 (void)gwps;
543#endif 570#endif
@@ -556,7 +583,7 @@ static const char* skip_conditional(struct gui_wps *gwps, const char* fmt, int n
556 if(n >= 'A' && n <= 'Z') 583 if(n >= 'A' && n <= 'Z')
557 n = n - 'A' + 26; 584 n = n - 'A' + 26;
558 if(last_x != data->img[n].x || last_y != data->img[n].y 585 if(last_x != data->img[n].x || last_y != data->img[n].y
559 || last_w != data->img[n].w || last_h != data->img[n].h) 586 || last_w != data->img[n].w || last_h != data->img[n].h)
560 { 587 {
561 last_x = data->img[n].x; 588 last_x = data->img[n].x;
562 last_y = data->img[n].y; 589 last_y = data->img[n].y;
@@ -639,13 +666,13 @@ static const char* skip_conditional(struct gui_wps *gwps, const char* fmt, int n
639 * flags - returns the type of the line. See constants i wps-display.h 666 * flags - returns the type of the line. See constants i wps-display.h
640 */ 667 */
641static void format_display(struct gui_wps *gwps, char* buf, 668static void format_display(struct gui_wps *gwps, char* buf,
642 int buf_size, 669 int buf_size,
643 struct mp3entry* id3, 670 struct mp3entry* id3,
644 struct mp3entry* nid3, /* next song's id3 */ 671 struct mp3entry* nid3, /* next song's id3 */
645 const char* fmt, 672 const char* fmt,
646 struct align_pos* align, 673 struct align_pos* align,
647 unsigned short* subline_time_mult, 674 unsigned short* subline_time_mult,
648 unsigned char* flags) 675 unsigned char* flags)
649{ 676{
650 char temp_buf[128]; 677 char temp_buf[128];
651 char* buf_start = buf; 678 char* buf_start = buf;
@@ -774,9 +801,9 @@ static void format_display(struct gui_wps *gwps, char* buf,
774 801
775 case '?': 802 case '?':
776 fmt++; 803 fmt++;
777 value = get_tag(gwps->data, id3, nid3, fmt, temp_buf, sizeof(temp_buf), 804 value = get_tag(gwps->data, id3, nid3, fmt, temp_buf,
778 &tag_length, subline_time_mult, flags, 805 sizeof(temp_buf),&tag_length,
779 &intval); 806 subline_time_mult, flags, &intval);
780 807
781 while (*fmt && ('<' != *fmt)) 808 while (*fmt && ('<' != *fmt))
782 fmt++; 809 fmt++;
@@ -796,9 +823,9 @@ static void format_display(struct gui_wps *gwps, char* buf,
796 break; 823 break;
797 824
798 default: 825 default:
799 value = get_tag(gwps->data, id3, nid3, fmt, temp_buf, sizeof(temp_buf), 826 value = get_tag(gwps->data, id3, nid3, fmt, temp_buf,
800 &tag_length, subline_time_mult, flags, 827 sizeof(temp_buf), &tag_length,
801 &intval); 828 subline_time_mult, flags,&intval);
802 fmt += tag_length; 829 fmt += tag_length;
803 830
804 if (value) 831 if (value)
@@ -882,9 +909,9 @@ void fade(bool fade_in)
882} 909}
883 910
884/* Set format string to use for WPS, splitting it into lines */ 911/* Set format string to use for WPS, splitting it into lines */
885void gui_wps_format(struct wps_data *data, const char *bmpdir, size_t bmpdirlen) 912void gui_wps_format(struct wps_data *data, const char *bmpdir,
913 size_t bmpdirlen)
886{ 914{
887 if(!data) return;
888 char* buf = data->format_buffer; 915 char* buf = data->format_buffer;
889 char* start_of_line = data->format_buffer; 916 char* start_of_line = data->format_buffer;
890 int line = 0; 917 int line = 0;
@@ -894,10 +921,13 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir, size_t bmpdirlen)
894 (void)bmpdir; 921 (void)bmpdir;
895 (void)bmpdirlen; 922 (void)bmpdirlen;
896#else 923#else
897 unsigned char* img_buf_ptr = data->img_buf; /* where are in image buffer? */ 924 unsigned char* img_buf_ptr = data->img_buf; /* where in image buffer */
898 925
899 int img_buf_free = IMG_BUFSIZE; /* free space in image buffer */ 926 int img_buf_free = IMG_BUFSIZE; /* free space in image buffer */
900#endif 927#endif
928 if(!data)
929 return;
930
901 for (line=0; line<WPS_MAX_LINES; line++) 931 for (line=0; line<WPS_MAX_LINES; line++)
902 { 932 {
903 for (subline=0; subline<WPS_MAX_SUBLINES; subline++) 933 for (subline=0; subline<WPS_MAX_SUBLINES; subline++)
@@ -1095,9 +1125,10 @@ static void wps_display_images(struct gui_wps *gwps)
1095 display->set_drawmode(DRMODE_SOLID); 1125 display->set_drawmode(DRMODE_SOLID);
1096 1126
1097 display->mono_bitmap(data->img[n].ptr, data->img[n].x, 1127 display->mono_bitmap(data->img[n].ptr, data->img[n].x,
1098 data->img[n].y, data->img[n].w, data->img[n].h); 1128 data->img[n].y, data->img[n].w,
1129 data->img[n].h);
1099 display->update_rect(data->img[n].x, data->img[n].y, 1130 display->update_rect(data->img[n].x, data->img[n].y,
1100 data->img[n].w, data->img[n].h); 1131 data->img[n].w, data->img[n].h);
1101 } 1132 }
1102 } 1133 }
1103 display->set_drawmode(DRMODE_SOLID); 1134 display->set_drawmode(DRMODE_SOLID);
@@ -1106,9 +1137,11 @@ static void wps_display_images(struct gui_wps *gwps)
1106 1137
1107void gui_wps_reset(struct gui_wps *gui_wps) 1138void gui_wps_reset(struct gui_wps *gui_wps)
1108{ 1139{
1109 if(!gui_wps || !gui_wps->data) return; 1140 if(!gui_wps || !gui_wps->data)
1141 return;
1110 gui_wps->data->wps_loaded = false; 1142 gui_wps->data->wps_loaded = false;
1111 memset(&gui_wps->data->format_buffer, 0, sizeof (gui_wps->data->format_buffer)); 1143 memset(&gui_wps->data->format_buffer, 0,
1144 sizeof(gui_wps->data->format_buffer));
1112} 1145}
1113 1146
1114bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, 1147bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
@@ -1125,7 +1158,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1125 struct wps_data *data = gwps->data; 1158 struct wps_data *data = gwps->data;
1126 struct wps_state *state = gwps->state; 1159 struct wps_state *state = gwps->state;
1127 struct screen *display = gwps->display; 1160 struct screen *display = gwps->display;
1128 if(!gwps || !data || !state || !display){ 1161 if(!gwps || !data || !state || !display)
1162 {
1129 return false; 1163 return false;
1130 } 1164 }
1131#ifdef HAVE_LCD_BITMAP 1165#ifdef HAVE_LCD_BITMAP
@@ -1263,13 +1297,15 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1263 { 1297 {
1264#define PROGRESS_BAR_HEIGHT 6 /* this should probably be defined elsewhere; config-*.h perhaps? */ 1298#define PROGRESS_BAR_HEIGHT 6 /* this should probably be defined elsewhere; config-*.h perhaps? */
1265 int sby = i*h + offset + (h > 7 ? (h - 6) / 2 : 1); 1299 int sby = i*h + offset + (h > 7 ? (h - 6) / 2 : 1);
1266 gui_scrollbar_draw(display, 0, sby, display->width, PROGRESS_BAR_HEIGHT, 1300 gui_scrollbar_draw(display, 0, sby, display->width,
1267 state->id3->length?state->id3->length:1, 0, 1301 PROGRESS_BAR_HEIGHT,
1268 state->id3->length?state->id3->elapsed + state->ff_rewind_count:0, 1302 state->id3->length?state->id3->length:1, 0,
1269 HORIZONTAL); 1303 state->id3->length?state->id3->elapsed + state->ff_rewind_count:0,
1304 HORIZONTAL);
1270#ifdef AB_REPEAT_ENABLE 1305#ifdef AB_REPEAT_ENABLE
1271 if ( ab_repeat_mode_enabled() ) 1306 if ( ab_repeat_mode_enabled() )
1272 ab_draw_markers(state->id3->length, 0, sby, LCD_WIDTH, PROGRESS_BAR_HEIGHT); 1307 ab_draw_markers(state->id3->length, 0, sby, LCD_WIDTH,
1308 PROGRESS_BAR_HEIGHT);
1273#endif 1309#endif
1274 update_line = true; 1310 update_line = true;
1275 } 1311 }
@@ -1553,6 +1589,7 @@ static bool draw_player_progress(struct gui_wps *gwps)
1553 int songpos = 0; 1589 int songpos = 0;
1554 int i,j; 1590 int i,j;
1555 struct wps_state *state = gwps->state; 1591 struct wps_state *state = gwps->state;
1592 struct screen *display = gwps->display;
1556 if (!state->id3) 1593 if (!state->id3)
1557 return false; 1594 return false;
1558 1595
@@ -1579,7 +1616,7 @@ static bool draw_player_progress(struct gui_wps *gwps)
1579 player_progressbar[i] += binline[i*5+j]; 1616 player_progressbar[i] += binline[i*5+j];
1580 } 1617 }
1581 } 1618 }
1582 gwps->display->define_pattern(gwps->data->wps_progress_pat[0], player_progressbar); 1619 display->define_pattern(gwps->data->wps_progress_pat[0], player_progressbar);
1583 return true; 1620 return true;
1584} 1621}
1585 1622
@@ -1622,6 +1659,8 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
1622 char timestr[7]; 1659 char timestr[7];
1623 1660
1624 struct wps_state *state = gwps->state; 1661 struct wps_state *state = gwps->state;
1662 struct screen *display = gwps->display;
1663 struct wps_data *data = gwps->data;
1625 1664
1626 for (i=0; i < buf_size; i++) 1665 for (i=0; i < buf_size; i++)
1627 buf[i] = ' '; 1666 buf[i] = ' ';
@@ -1683,8 +1722,9 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
1683 } 1722 }
1684 } 1723 }
1685 1724
1686 gwps->display->define_pattern(gwps->data->wps_progress_pat[lcd_char_pos+1],player_progressbar); 1725 display->define_pattern(data->wps_progress_pat[lcd_char_pos+1],
1687 buf[lcd_char_pos]=gwps->data->wps_progress_pat[lcd_char_pos+1]; 1726 player_progressbar);
1727 buf[lcd_char_pos]=data->wps_progress_pat[lcd_char_pos+1];
1688 1728
1689 } 1729 }
1690 1730
@@ -1714,9 +1754,9 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
1714 } 1754 }
1715 } 1755 }
1716 1756
1717 gwps->display->define_pattern(gwps->data->wps_progress_pat[7],player_progressbar); 1757 display->define_pattern(data->wps_progress_pat[7],player_progressbar);
1718 1758
1719 buf[songpos/5]=gwps->data->wps_progress_pat[7]; 1759 buf[songpos/5]=data->wps_progress_pat[7];
1720 } 1760 }
1721} 1761}
1722#endif 1762#endif
@@ -1735,11 +1775,11 @@ bool setvol(void)
1735 gui_syncstatusbar_draw(&statusbars, false); 1775 gui_syncstatusbar_draw(&statusbars, false);
1736 int i; 1776 int i;
1737 FOR_NB_SCREENS(i) 1777 FOR_NB_SCREENS(i)
1738 gui_wps_refresh(&gui_syncwps.gui_wps[i], 0, WPS_REFRESH_NON_STATIC); 1778 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
1739 settings_save(); 1779 settings_save();
1740#ifdef HAVE_LCD_CHARCELLS 1780#ifdef HAVE_LCD_CHARCELLS
1741 gui_syncsplash(0, false, "Vol: %d %% ", 1781 gui_syncsplash(0, false, "Vol: %d %% ",
1742 sound_val2phys(SOUND_VOLUME, global_settings.volume)); 1782 sound_val2phys(SOUND_VOLUME, global_settings.volume));
1743 return true; 1783 return true;
1744#endif 1784#endif
1745 return false; 1785 return false;
@@ -1763,8 +1803,10 @@ bool ffwd_rew(int button)
1763 bool usb = false; 1803 bool usb = false;
1764 int i = 0; 1804 int i = 0;
1765 1805
1766 while (!exit) { 1806 while (!exit)
1767 switch ( button ) { 1807 {
1808 switch ( button )
1809 {
1768 case WPS_FFWD: 1810 case WPS_FFWD:
1769#ifdef WPS_RC_FFWD 1811#ifdef WPS_RC_FFWD
1770 case WPS_RC_FFWD: 1812 case WPS_RC_FFWD:
@@ -1779,8 +1821,9 @@ bool ffwd_rew(int button)
1779 if (direction == 1) 1821 if (direction == 1)
1780 { 1822 {
1781 /* fast forwarding, calc max step relative to end */ 1823 /* fast forwarding, calc max step relative to end */
1782 max_step = 1824 max_step = (wps_state.id3->length -
1783 (wps_state.id3->length - (wps_state.id3->elapsed + ff_rewind_count)) * 1825 (wps_state.id3->elapsed +
1826 ff_rewind_count)) *
1784 FF_REWIND_MAX_PERCENT / 100; 1827 FF_REWIND_MAX_PERCENT / 100;
1785 } 1828 }
1786 else 1829 else
@@ -1814,7 +1857,7 @@ bool ffwd_rew(int button)
1814 audio_pause(); 1857 audio_pause();
1815#if CONFIG_KEYPAD == PLAYER_PAD 1858#if CONFIG_KEYPAD == PLAYER_PAD
1816 FOR_NB_SCREENS(i) 1859 FOR_NB_SCREENS(i)
1817 gui_syncwps.gui_wps[i].display->stop_scroll(); 1860 gui_wps[i].display->stop_scroll();
1818#endif 1861#endif
1819 if (direction > 0) 1862 if (direction > 0)
1820 status_set_ffmode(STATUS_FASTFORWARD); 1863 status_set_ffmode(STATUS_FASTFORWARD);
@@ -1833,26 +1876,22 @@ bool ffwd_rew(int button)
1833 } 1876 }
1834 1877
1835 if (direction > 0) { 1878 if (direction > 0) {
1836 if ((wps_state.id3->elapsed + ff_rewind_count) > wps_state.id3->length) 1879 if ((wps_state.id3->elapsed + ff_rewind_count) >
1837 ff_rewind_count = wps_state.id3->length - wps_state.id3->elapsed; 1880 wps_state.id3->length)
1881 ff_rewind_count = wps_state.id3->length -
1882 wps_state.id3->elapsed;
1838 } 1883 }
1839 else { 1884 else {
1840 if ((int)(wps_state.id3->elapsed + ff_rewind_count) < 0) 1885 if ((int)(wps_state.id3->elapsed + ff_rewind_count) < 0)
1841 ff_rewind_count = -wps_state.id3->elapsed; 1886 ff_rewind_count = -wps_state.id3->elapsed;
1842 } 1887 }
1843 1888
1844 if(wps_state.wps_time_countup == false){ 1889 FOR_NB_SCREENS(i)
1845 FOR_NB_SCREENS(i) 1890 gui_wps_refresh(&gui_wps[i],
1846 gui_wps_refresh(&gui_syncwps.gui_wps[i], ff_rewind_count, 1891 (wps_state.wps_time_countup == false)?
1847 WPS_REFRESH_PLAYER_PROGRESS | 1892 ff_rewind_count:-ff_rewind_count,
1848 WPS_REFRESH_DYNAMIC); 1893 WPS_REFRESH_PLAYER_PROGRESS |
1849 } 1894 WPS_REFRESH_DYNAMIC);
1850 else{
1851 FOR_NB_SCREENS(i)
1852 gui_wps_refresh(&gui_syncwps.gui_wps[i], -ff_rewind_count,
1853 WPS_REFRESH_PLAYER_PROGRESS |
1854 WPS_REFRESH_DYNAMIC);
1855 }
1856 1895
1857 break; 1896 break;
1858 1897
@@ -1889,7 +1928,7 @@ bool ffwd_rew(int button)
1889 /* let audio thread update id3->elapsed before calling wps_refresh */ 1928 /* let audio thread update id3->elapsed before calling wps_refresh */
1890 yield(); 1929 yield();
1891 FOR_NB_SCREENS(i) 1930 FOR_NB_SCREENS(i)
1892 gui_wps_refresh(&gui_syncwps.gui_wps[i], 0, WPS_REFRESH_ALL); 1931 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
1893 return usb; 1932 return usb;
1894} 1933}
1895 1934
@@ -1911,13 +1950,14 @@ bool gui_wps_display(void)
1911 { 1950 {
1912 FOR_NB_SCREENS(i) 1951 FOR_NB_SCREENS(i)
1913 { 1952 {
1914 gui_syncwps.gui_wps[i].display->clear_display(); 1953 gui_wps[i].display->clear_display();
1915 if (!gui_syncwps.gui_wps[i].data->wps_loaded) { 1954 if (!gui_wps[i].data->wps_loaded) {
1916 if ( !gui_syncwps.gui_wps[i].data->format_buffer[0] ) { 1955 if ( !gui_wps[i].data->format_buffer[0] ) {
1917 /* set the default wps for the main-screen */ 1956 /* set the default wps for the main-screen */
1918 if(i == 0){ 1957 if(i == 0)
1958 {
1919#ifdef HAVE_LCD_BITMAP 1959#ifdef HAVE_LCD_BITMAP
1920 wps_data_load(gui_syncwps.gui_wps[i].data, 1960 wps_data_load(gui_wps[i].data,
1921 "%s%?it<%?in<%in. |>%it|%fn>\n" 1961 "%s%?it<%?in<%in. |>%it|%fn>\n"
1922 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 1962 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
1923 "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n" 1963 "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
@@ -1927,7 +1967,7 @@ bool gui_wps_display(void)
1927 "%pb\n" 1967 "%pb\n"
1928 "%pm\n", false, false); 1968 "%pm\n", false, false);
1929#else 1969#else
1930 wps_data_load(gui_syncwps.gui_wps[i].data, 1970 wps_data_load(gui_wps[i].data,
1931 "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n" 1971 "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
1932 "%pc%?ps<*|/>%pt\n", false, false); 1972 "%pc%?ps<*|/>%pt\n", false, false);
1933#endif 1973#endif
@@ -1936,7 +1976,7 @@ bool gui_wps_display(void)
1936 /* set the default wps for the remote-screen */ 1976 /* set the default wps for the remote-screen */
1937 else if(i == 1) 1977 else if(i == 1)
1938 { 1978 {
1939 wps_data_load(gui_syncwps.gui_wps[i].data, 1979 wps_data_load(gui_wps[i].data,
1940 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 1980 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
1941 "%s%?it<%?in<%in. |>%it|%fn>\n" 1981 "%s%?it<%?in<%in. |>%it|%fn>\n"
1942 "%al%pc/%pt%ar[%pp:%pe]\n" 1982 "%al%pc/%pt%ar[%pp:%pe]\n"
@@ -1950,13 +1990,13 @@ bool gui_wps_display(void)
1950 } 1990 }
1951 yield(); 1991 yield();
1952 FOR_NB_SCREENS(i) 1992 FOR_NB_SCREENS(i)
1953 gui_wps_refresh(&gui_syncwps.gui_wps[i], 0, WPS_REFRESH_ALL); 1993 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
1954 gui_syncstatusbar_draw(&statusbars, true); 1994 gui_syncstatusbar_draw(&statusbars, true);
1955 FOR_NB_SCREENS(i) 1995 FOR_NB_SCREENS(i)
1956 { 1996 {
1957#ifdef HAVE_LCD_BITMAP 1997#ifdef HAVE_LCD_BITMAP
1958 wps_display_images(&gui_syncwps.gui_wps[i]); 1998 wps_display_images(&gui_wps[i]);
1959 gui_syncwps.gui_wps[i].display->update(); 1999 gui_wps[i].display->update();
1960#endif 2000#endif
1961 } 2001 }
1962 return false; 2002 return false;
@@ -1980,12 +2020,11 @@ bool update(struct gui_wps *gwps)
1980 2020
1981 if (gwps->state->id3) 2021 if (gwps->state->id3)
1982 memcpy(gwps->state->current_track_path, gwps->state->id3->path, 2022 memcpy(gwps->state->current_track_path, gwps->state->id3->path,
1983 sizeof(gwps->state->current_track_path)); 2023 sizeof(gwps->state->current_track_path));
1984 } 2024 }
1985 2025
1986 if (gwps->state->id3){ 2026 if (gwps->state->id3)
1987 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 2027 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
1988 }
1989 2028
1990 gui_syncstatusbar_draw(&statusbars, false); 2029 gui_syncstatusbar_draw(&statusbars, false);
1991 2030
@@ -1998,7 +2037,7 @@ void display_keylock_text(bool locked)
1998 char* s; 2037 char* s;
1999 int i; 2038 int i;
2000 FOR_NB_SCREENS(i) 2039 FOR_NB_SCREENS(i)
2001 gui_syncwps.gui_wps[i].display->stop_scroll(); 2040 gui_wps[i].display->stop_scroll();
2002 2041
2003#ifdef HAVE_LCD_CHARCELLS 2042#ifdef HAVE_LCD_CHARCELLS
2004 if(locked) 2043 if(locked)
diff --git a/apps/gui/gwps-common.h b/apps/gui/gwps-common.h
index 5cf052898d..fe7f2f66da 100644
--- a/apps/gui/gwps-common.h
+++ b/apps/gui/gwps-common.h
@@ -1,18 +1,32 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
1#ifndef _GWPS_COMMON_ 19#ifndef _GWPS_COMMON_
2#define _GWPS_COMMON_ 20#define _GWPS_COMMON_
3#include <stdbool.h> 21#include <stdbool.h>
4#include <sys/types.h> /* for size_t */ 22#include <sys/types.h> /* for size_t */
5 23
6/* to avoid the unnecessary include if gwps.h */ 24#include "gwps.h"
7struct mp3entry;
8struct gui_img;
9struct wps_data;
10struct gui_wps;
11struct align_pos;
12 25
13void gui_wps_format_time(char* buf, int buf_size, long time); 26void gui_wps_format_time(char* buf, int buf_size, long time);
14void fade(bool fade_in); 27void fade(bool fade_in);
15void gui_wps_format(struct wps_data *data, const char *bmpdir, size_t bmpdirlen); 28void gui_wps_format(struct wps_data *data, const char *bmpdir,
29 size_t bmpdirlen);
16bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, 30bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
17 unsigned char refresh_mode); 31 unsigned char refresh_mode);
18bool gui_wps_display(void); 32bool gui_wps_display(void);
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 4fc9acbece..f06ea5baf1 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -1,3 +1,21 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Jerome Kuptz
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
1#include <stdio.h> 19#include <stdio.h>
2#include <string.h> 20#include <string.h>
3#include <stdlib.h> 21#include <stdlib.h>
@@ -42,12 +60,15 @@
42#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps" 60#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
43/* currently only on wps_state is needed */ 61/* currently only on wps_state is needed */
44struct wps_state wps_state; 62struct wps_state wps_state;
45struct gui_syncwps gui_syncwps; 63struct gui_wps gui_wps[NB_SCREENS];
46struct wps_data wps_datas[NB_SCREENS]; 64static struct wps_data wps_datas[NB_SCREENS];
47 65
48bool keys_locked = false; 66static bool keys_locked = false;
49 67
50long gui_wps_show() 68/* change the path to the current played track */
69static void wps_state_update_ctp(const char *path);
70
71long gui_wps_show(void)
51{ 72{
52 long button = 0, lastbutton = 0; 73 long button = 0, lastbutton = 0;
53 bool ignore_keyup = true; 74 bool ignore_keyup = true;
@@ -67,10 +88,8 @@ long gui_wps_show()
67#else 88#else
68 FOR_NB_SCREENS(i) 89 FOR_NB_SCREENS(i)
69 { 90 {
70 if(global_settings.statusbar) 91 gui_wps[i].display->setmargins(0, global_settings.statusbar?
71 gui_syncwps.gui_wps[i].display->setmargins(0, STATUSBAR_HEIGHT); 92 STATUSBAR_HEIGHT:0);
72 else
73 gui_syncwps.gui_wps[i].display->setmargins(0, 0);
74 } 93 }
75#endif 94#endif
76 95
@@ -87,7 +106,7 @@ long gui_wps_show()
87 if (gui_wps_display()) 106 if (gui_wps_display())
88 return 0; 107 return 0;
89 FOR_NB_SCREENS(i) 108 FOR_NB_SCREENS(i)
90 gui_wps_refresh(&gui_syncwps.gui_wps[i], 0, WPS_REFRESH_ALL); 109 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
91 wps_state_update_ctp(wps_state.id3->path); 110 wps_state_update_ctp(wps_state.id3->path);
92 } 111 }
93 112
@@ -119,7 +138,7 @@ long gui_wps_show()
119 bool pm=false; 138 bool pm=false;
120 FOR_NB_SCREENS(i) 139 FOR_NB_SCREENS(i)
121 { 140 {
122 if(gui_syncwps.gui_wps[i].data->peak_meter_enabled) 141 if(gui_wps[i].data->peak_meter_enabled)
123 pm = true; 142 pm = true;
124 } 143 }
125 144
@@ -137,8 +156,12 @@ long gui_wps_show()
137 156
138 if (TIME_AFTER(current_tick, next_refresh)) { 157 if (TIME_AFTER(current_tick, next_refresh)) {
139 FOR_NB_SCREENS(i) 158 FOR_NB_SCREENS(i)
140 gui_wps_refresh(&gui_syncwps.gui_wps[i], 0, WPS_REFRESH_PEAK_METER); 159 {
141 next_refresh += HZ / PEAK_METER_FPS; 160 if(gui_wps[i].data->peak_meter_enabled)
161 gui_wps_refresh(&gui_wps[i], 0,
162 WPS_REFRESH_PEAK_METER);
163 next_refresh += HZ / PEAK_METER_FPS;
164 }
142 } 165 }
143 } 166 }
144 167
@@ -213,7 +236,7 @@ long gui_wps_show()
213 status_set_audio(false); 236 status_set_audio(false);
214#endif 237#endif
215 FOR_NB_SCREENS(i) 238 FOR_NB_SCREENS(i)
216 gui_syncwps.gui_wps[i].display->stop_scroll(); 239 gui_wps[i].display->stop_scroll();
217 240
218 /* set dir browser to current playing song */ 241 /* set dir browser to current playing song */
219 if (global_settings.browse_current && 242 if (global_settings.browse_current &&
@@ -232,7 +255,8 @@ long gui_wps_show()
232#ifdef WPS_RC_PAUSE 255#ifdef WPS_RC_PAUSE
233 case WPS_RC_PAUSE: 256 case WPS_RC_PAUSE:
234#ifdef WPS_RC_PAUSE_PRE 257#ifdef WPS_RC_PAUSE_PRE
235 if ((button == WPS_RC_PAUSE) && (lastbutton != WPS_RC_PAUSE_PRE)) 258 if ((button == WPS_RC_PAUSE) &&
259 (lastbutton != WPS_RC_PAUSE_PRE))
236 break; 260 break;
237#endif 261#endif
238#endif 262#endif
@@ -333,7 +357,8 @@ long gui_wps_show()
333#ifdef AB_REPEAT_ENABLE 357#ifdef AB_REPEAT_ENABLE
334 /* if we're in A/B repeat mode and the current position 358 /* if we're in A/B repeat mode and the current position
335 is past the A marker, jump back to the A marker... */ 359 is past the A marker, jump back to the A marker... */
336 if ( ab_repeat_mode_enabled() && ab_after_A_marker(wps_state.id3->elapsed) ) 360 if ( ab_repeat_mode_enabled()
361 && ab_after_A_marker(wps_state.id3->elapsed) )
337 { 362 {
338 ab_jump_to_A_marker(); 363 ab_jump_to_A_marker();
339 break; 364 break;
@@ -391,7 +416,8 @@ long gui_wps_show()
391#ifdef AB_REPEAT_ENABLE 416#ifdef AB_REPEAT_ENABLE
392 /* if we're in A/B repeat mode and the current position is 417 /* if we're in A/B repeat mode and the current position is
393 before the A marker, jump to the A marker... */ 418 before the A marker, jump to the A marker... */
394 if ( ab_repeat_mode_enabled() && ab_before_A_marker(wps_state.id3->elapsed) ) 419 if ( ab_repeat_mode_enabled()
420 && ab_before_A_marker(wps_state.id3->elapsed) )
395 { 421 {
396 ab_jump_to_A_marker(); 422 ab_jump_to_A_marker();
397 break; 423 break;
@@ -417,17 +443,16 @@ long gui_wps_show()
417#endif 443#endif
418#endif 444#endif
419 FOR_NB_SCREENS(i) 445 FOR_NB_SCREENS(i)
420 gui_syncwps.gui_wps[i].display->stop_scroll(); 446 gui_wps[i].display->stop_scroll();
421 447
422 if (main_menu()) 448 if (main_menu())
423 return true; 449 return true;
424#ifdef HAVE_LCD_BITMAP 450#ifdef HAVE_LCD_BITMAP
425 FOR_NB_SCREENS(i) 451 FOR_NB_SCREENS(i)
426 { 452 {
427 if(global_settings.statusbar) 453 gui_wps[i].display->setmargins(0,
428 gui_syncwps.gui_wps[i].display->setmargins(0, STATUSBAR_HEIGHT); 454 global_settings.statusbar?
429 else 455 STATUSBAR_HEIGHT:0);
430 gui_syncwps.gui_wps[i].display->setmargins(0, 0);
431 } 456 }
432#endif 457#endif
433 restore = true; 458 restore = true;
@@ -552,8 +577,9 @@ long gui_wps_show()
552 if (update_track) 577 if (update_track)
553 { 578 {
554 bool upt = false; 579 bool upt = false;
555 FOR_NB_SCREENS(i){ 580 FOR_NB_SCREENS(i)
556 if(update(&gui_syncwps.gui_wps[i])) 581 {
582 if(update(&gui_wps[i]))
557 upt = true; 583 upt = true;
558 } 584 }
559 if (upt) 585 if (upt)
@@ -577,7 +603,7 @@ long gui_wps_show()
577 fade(0); 603 fade(0);
578 604
579 FOR_NB_SCREENS(i) 605 FOR_NB_SCREENS(i)
580 gui_syncwps.gui_wps[i].display->stop_scroll(); 606 gui_wps[i].display->stop_scroll();
581 bookmark_autobookmark(); 607 bookmark_autobookmark();
582 audio_stop(); 608 audio_stop();
583#ifdef AB_REPEAT_ENABLE 609#ifdef AB_REPEAT_ENABLE
@@ -617,7 +643,7 @@ long gui_wps_show()
617 643
618 if (wps_state.id3){ 644 if (wps_state.id3){
619 FOR_NB_SCREENS(i) 645 FOR_NB_SCREENS(i)
620 gui_wps_refresh(&gui_syncwps.gui_wps[i], 0, WPS_REFRESH_NON_STATIC); 646 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
621 } 647 }
622 } 648 }
623 if (button != BUTTON_NONE) 649 if (button != BUTTON_NONE)
@@ -674,11 +700,17 @@ static void wps_reset(struct wps_data *data)
674 700
675/* to setup up the wps-data from a format-buffer (isfile = false) 701/* to setup up the wps-data from a format-buffer (isfile = false)
676 from a (wps-)file (isfile = true)*/ 702 from a (wps-)file (isfile = true)*/
677bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool display) 703bool wps_data_load(struct wps_data *wps_data,
704 const char *buf,
705 bool isfile,
706 bool display)
678{ 707{
679 int i, s; 708 int i, s;
680 int fd; 709 int fd;
681 if(!wps_data || !buf) return false; 710
711 if(!wps_data || !buf)
712 return false;
713
682 if(!isfile) 714 if(!isfile)
683 { 715 {
684 wps_clear(wps_data); 716 wps_clear(wps_data);
@@ -694,9 +726,10 @@ bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool
694 * wants to be a virtual file. Feel free to modify dirbrowse() 726 * wants to be a virtual file. Feel free to modify dirbrowse()
695 * if you're feeling brave. 727 * if you're feeling brave.
696 */ 728 */
697 if (! strcmp(buf, WPS_DEFAULTCFG) || !strcmp(buf, RWPS_DEFAULTCFG) ) { 729 if (! strcmp(buf, WPS_DEFAULTCFG) || !strcmp(buf, RWPS_DEFAULTCFG) )
698 wps_reset(wps_data); 730 {
699 return false; 731 wps_reset(wps_data);
732 return false;
700 } 733 }
701 size_t bmpdirlen; 734 size_t bmpdirlen;
702 char *bmpdir = strrchr(buf, '.'); 735 char *bmpdir = strrchr(buf, '.');
@@ -706,7 +739,8 @@ bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool
706 739
707 if (fd >= 0) 740 if (fd >= 0)
708 { 741 {
709 int numread = read(fd, wps_data->format_buffer, sizeof(wps_data->format_buffer) - 1); 742 int numread = read(fd, wps_data->format_buffer,
743 sizeof(wps_data->format_buffer) - 1);
710 744
711 if (numread > 0) 745 if (numread > 0)
712 { 746 {
@@ -733,24 +767,19 @@ bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool
733 any_defined_line = false; 767 any_defined_line = false;
734 for (i=0; i<WPS_MAX_LINES; i++) 768 for (i=0; i<WPS_MAX_LINES; i++)
735 { 769 {
736 if (wps_data->format_lines[i][s]) 770 if (wps_data->format_lines[i][s] &&
771 wps_data->format_lines[i][s][0])
737 { 772 {
738 if (*(wps_data->format_lines[i][s]) == 0) 773 FOR_NB_SCREENS(z)
739 { 774 screens[z].puts(0, i,
740 FOR_NB_SCREENS(z) 775 wps_data->
741 screens[z].puts(0,i," "); 776 format_lines[i][s]);
742 }
743 else
744 {
745 FOR_NB_SCREENS(z)
746 screens[z].puts(0,i,wps_data->format_lines[i][s]);
747 }
748 any_defined_line = true; 777 any_defined_line = true;
749 } 778 }
750 else 779 else
751 { 780 {
752 FOR_NB_SCREENS(z) 781 FOR_NB_SCREENS(z)
753 screens[z].puts(0,i," "); 782 screens[z].puts(0, i, " ");
754 } 783 }
755 } 784 }
756 if (any_defined_line) 785 if (any_defined_line)
@@ -759,7 +788,7 @@ bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool
759 FOR_NB_SCREENS(z) 788 FOR_NB_SCREENS(z)
760 screens[z].update(); 789 screens[z].update();
761#endif 790#endif
762 sleep(HZ/2); 791 sleep(HZ/2);
763 } 792 }
764 } 793 }
765 } 794 }
@@ -775,7 +804,6 @@ bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool
775/* wps_data end */ 804/* wps_data end */
776 805
777/* wps_state */ 806/* wps_state */
778struct wps_state wps_state;
779 807
780void wps_state_init(void) 808void wps_state_init(void)
781{ 809{
@@ -785,23 +813,31 @@ void wps_state_init(void)
785 wps_state.nid3 = NULL; 813 wps_state.nid3 = NULL;
786 wps_state.current_track_path[0] = '\0'; 814 wps_state.current_track_path[0] = '\0';
787} 815}
816
817#if 0
818/* these are obviously not used? */
819
788void wps_state_update_ff_rew(bool ff_rew) 820void wps_state_update_ff_rew(bool ff_rew)
789{ 821{
790 wps_state.ff_rewind = ff_rew; 822 wps_state.ff_rewind = ff_rew;
791} 823}
824
792void wps_state_update_paused(bool paused) 825void wps_state_update_paused(bool paused)
793{ 826{
794 wps_state.paused = paused; 827 wps_state.paused = paused;
795} 828}
796void wps_state_update_ctp(const char *path)
797{
798 memcpy(wps_state.current_track_path, path, sizeof(wps_state.current_track_path));
799}
800void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3) 829void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3)
801{ 830{
802 wps_state.id3 = id3; 831 wps_state.id3 = id3;
803 wps_state.nid3 = nid3; 832 wps_state.nid3 = nid3;
804} 833}
834#endif
835
836static void wps_state_update_ctp(const char *path)
837{
838 memcpy(wps_state.current_track_path, path,
839 sizeof(wps_state.current_track_path));
840}
805/* wps_state end*/ 841/* wps_state end*/
806 842
807/* initial setup of a wps */ 843/* initial setup of a wps */
@@ -838,7 +874,7 @@ void gui_sync_wps_screen_init(void)
838{ 874{
839 int i; 875 int i;
840 FOR_NB_SCREENS(i) 876 FOR_NB_SCREENS(i)
841 gui_wps_set_disp(&gui_syncwps.gui_wps[i], &screens[i]); 877 gui_wps_set_disp(&gui_wps[i], &screens[i]);
842} 878}
843 879
844void gui_sync_wps_init(void) 880void gui_sync_wps_init(void)
@@ -846,8 +882,7 @@ void gui_sync_wps_init(void)
846 int i; 882 int i;
847 FOR_NB_SCREENS(i) 883 FOR_NB_SCREENS(i)
848 { 884 {
849 gui_wps_init(&gui_syncwps.gui_wps[i]); 885 gui_wps_init(&gui_wps[i]);
850 gui_wps_set_data(&gui_syncwps.gui_wps[i], &wps_datas[i]); 886 gui_wps_set_data(&gui_wps[i], &wps_datas[i]);
851 } 887 }
852} 888}
853
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index b5fddd556f..d8cc6a78c0 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -145,7 +145,7 @@
145#define WPS_INCVOL BUTTON_UP 145#define WPS_INCVOL BUTTON_UP
146#define WPS_DECVOL BUTTON_DOWN 146#define WPS_DECVOL BUTTON_DOWN
147#define WPS_PAUSE BUTTON_OFF 147#define WPS_PAUSE BUTTON_OFF
148/* #define WPS_MENU Ondio can't have both main menu and context menu in wps */ 148/* #define WPS_MENU Ondio can't have both main menu and context menu in wps */
149#define WPS_BROWSE (BUTTON_MENU | BUTTON_REL) 149#define WPS_BROWSE (BUTTON_MENU | BUTTON_REL)
150#define WPS_BROWSE_PRE BUTTON_MENU 150#define WPS_BROWSE_PRE BUTTON_MENU
151#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_DOWN) 151#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_DOWN)
@@ -183,7 +183,7 @@
183#define WPS_INCVOL BUTTON_UP 183#define WPS_INCVOL BUTTON_UP
184#define WPS_DECVOL BUTTON_DOWN 184#define WPS_DECVOL BUTTON_DOWN
185#define WPS_PAUSE BUTTON_OFF 185#define WPS_PAUSE BUTTON_OFF
186/* #define WPS_MENU iPod can't have both main menu and context menu in wps */ 186/* #define WPS_MENU iPod can't have both main menu and context menu in wps */
187#define WPS_BROWSE (BUTTON_MENU | BUTTON_REL) 187#define WPS_BROWSE (BUTTON_MENU | BUTTON_REL)
188#define WPS_BROWSE_PRE BUTTON_MENU 188#define WPS_BROWSE_PRE BUTTON_MENU
189#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_DOWN) 189#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_DOWN)
@@ -253,6 +253,8 @@ struct wps_data
253#ifdef HAVE_LCD_BITMAP 253#ifdef HAVE_LCD_BITMAP
254 struct gui_img img[MAX_IMAGES]; 254 struct gui_img img[MAX_IMAGES];
255 unsigned char img_buf[IMG_BUFSIZE]; 255 unsigned char img_buf[IMG_BUFSIZE];
256 bool wps_sb_tag;
257 bool show_sb_on_wps;
256#endif 258#endif
257#ifdef HAVE_LCD_CHARCELLS 259#ifdef HAVE_LCD_CHARCELLS
258 unsigned char wps_progress_pat[8]; 260 unsigned char wps_progress_pat[8];
@@ -274,7 +276,10 @@ void wps_data_init(struct wps_data *wps_data);
274 276
275/* to setup up the wps-data from a format-buffer (isfile = false) 277/* to setup up the wps-data from a format-buffer (isfile = false)
276 from a (wps-)file (isfile = true)*/ 278 from a (wps-)file (isfile = true)*/
277bool wps_data_load(struct wps_data *wps_data, const char *buf, bool isfile, bool display); 279bool wps_data_load(struct wps_data *wps_data,
280 const char *buf,
281 bool isfile,
282 bool display);
278 283
279/* wps_data end */ 284/* wps_data end */
280 285
@@ -301,13 +306,6 @@ void wps_state_init(void);
301 else we are in normal mode */ 306 else we are in normal mode */
302void wps_state_update_ff_rew(bool ff_rew); 307void wps_state_update_ff_rew(bool ff_rew);
303 308
304/* change the paused-status
305 to indicate if playback is currently paused or not */
306void wps_state_update_paused(bool paused);
307
308/* change the path to the current played track */
309void wps_state_update_ctp(const char *path);
310
311/* change the tag-information of the current played track 309/* change the tag-information of the current played track
312 and the following track */ 310 and the following track */
313void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3); 311void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3);
@@ -318,7 +316,7 @@ void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3);
318 and the screen on which the wps-content should be drawn */ 316 and the screen on which the wps-content should be drawn */
319struct gui_wps 317struct gui_wps
320{ 318{
321 struct screen * display; 319 struct screen * display;
322 struct wps_data *data; 320 struct wps_data *data;
323 struct wps_state *state; 321 struct wps_state *state;
324}; 322};
@@ -333,16 +331,11 @@ void gui_wps_set_data(struct gui_wps *gui_wps, struct wps_data *data);
333void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display); 331void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display);
334/* gui_wps end */ 332/* gui_wps end */
335 333
336struct gui_syncwps
337{
338 struct gui_wps gui_wps[NB_SCREENS];
339};
340long gui_wps_show(void); 334long gui_wps_show(void);
341 335
342/* currently only on wps_state is needed */ 336/* currently only on wps_state is needed */
343extern struct wps_state wps_state; 337extern struct wps_state wps_state;
344extern struct gui_syncwps gui_syncwps; 338extern struct gui_wps gui_wps[NB_SCREENS];
345extern struct wps_data wps_datas[NB_SCREENS];
346 339
347void gui_sync_wps_init(void); 340void gui_sync_wps_init(void);
348void gui_sync_data_wps_init(void); 341void gui_sync_data_wps_init(void);
diff --git a/apps/settings.c b/apps/settings.c
index 2e5014fce7..36bd332ae3 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -890,20 +890,20 @@ void settings_apply(void)
890 global_settings.wps_file[0] != 0xff ) { 890 global_settings.wps_file[0] != 0xff ) {
891 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", 891 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
892 global_settings.wps_file); 892 global_settings.wps_file);
893 wps_data_load(gui_syncwps.gui_wps[0].data, buf, true, false); 893 wps_data_load(gui_wps[0].data, buf, true, false);
894 } 894 }
895 else 895 else
896 wps_data_init(gui_syncwps.gui_wps[0].data); 896 wps_data_init(gui_wps[0].data);
897 897
898#ifdef HAVE_REMOTE_LCD 898#ifdef HAVE_REMOTE_LCD
899 if ( global_settings.rwps_file[0] && 899 if ( global_settings.rwps_file[0] &&
900 global_settings.rwps_file[0] != 0xff ) { 900 global_settings.rwps_file[0] != 0xff ) {
901 snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", 901 snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
902 global_settings.rwps_file); 902 global_settings.rwps_file);
903 wps_data_load(gui_syncwps.gui_wps[1].data, buf, true, false); 903 wps_data_load(gui_wps[1].data, buf, true, false);
904 } 904 }
905 else 905 else
906 wps_data_init(gui_syncwps.gui_wps[1].data); 906 wps_data_init(gui_wps[1].data);
907#endif 907#endif
908 908
909#ifdef HAVE_LCD_BITMAP 909#ifdef HAVE_LCD_BITMAP
@@ -1166,12 +1166,12 @@ bool settings_load_config(const char* file)
1166 1166
1167 /* check for the string values */ 1167 /* check for the string values */
1168 if (!strcasecmp(name, "wps")) { 1168 if (!strcasecmp(name, "wps")) {
1169 if (wps_data_load(gui_syncwps.gui_wps[0].data,value,true, false)) 1169 if (wps_data_load(gui_wps[0].data,value,true, false))
1170 set_file(value, global_settings.wps_file, MAX_FILENAME); 1170 set_file(value, global_settings.wps_file, MAX_FILENAME);
1171 } 1171 }
1172#ifdef HAVE_REMOTE_LCD 1172#ifdef HAVE_REMOTE_LCD
1173 else if (!strcasecmp(name, "rwps")) { 1173 else if (!strcasecmp(name, "rwps")) {
1174 if (wps_data_load(gui_syncwps.gui_wps[1].data,value,true, false)) 1174 if (wps_data_load(gui_wps[1].data,value,true, false))
1175 set_file(value, global_settings.rwps_file, MAX_FILENAME); 1175 set_file(value, global_settings.rwps_file, MAX_FILENAME);
1176 } 1176 }
1177#endif 1177#endif
diff --git a/apps/tree.c b/apps/tree.c
index 284fdcbdc7..89a8522743 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -816,7 +816,8 @@ static bool dirbrowse(void)
816 else 816 else
817 { 817 {
818 DEBUGF("Playing file thumbnail: %s/%s%s\n", 818 DEBUGF("Playing file thumbnail: %s/%s%s\n",
819 currdir, dircache[lasti].name, file_thumbnail_ext); 819 currdir, dircache[lasti].name,
820 file_thumbnail_ext);
820 /* no fallback necessary, we knew in advance 821 /* no fallback necessary, we knew in advance
821 that the file exists */ 822 that the file exists */
822 ft_play_filename(currdir, dircache[lasti].name); 823 ft_play_filename(currdir, dircache[lasti].name);