summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-08-06 04:33:35 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-08-06 04:33:35 +0000
commit3790897189e008aba2c255a02f8294b50946a02e (patch)
treed7e7143e1c8e49224a0010544b9a415fe6557d8e
parent857741419c7ae2482dbef1c5456e85e35b513a4d (diff)
downloadrockbox-3790897189e008aba2c255a02f8294b50946a02e.tar.gz
rockbox-3790897189e008aba2c255a02f8294b50946a02e.zip
more wps->skin moving/renaming
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22180 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES4
-rw-r--r--apps/gui/skin_engine/skin_display.c (renamed from apps/gui/skin_engine/wps_display.c)98
-rw-r--r--apps/gui/skin_engine/skin_tokens.c (renamed from apps/gui/skin_engine/wps_tokens.c)0
-rw-r--r--apps/gui/skin_engine/wps_debug.c2
-rw-r--r--apps/gui/skin_engine/wps_internals.h14
-rw-r--r--apps/gui/skin_engine/wps_parser.c73
6 files changed, 94 insertions, 97 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 12ac54f38d..807f3ded9d 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -85,9 +85,9 @@ gui/yesno.c
85gui/viewport.c 85gui/viewport.c
86 86
87gui/skin_engine/wps_debug.c 87gui/skin_engine/wps_debug.c
88gui/skin_engine/wps_display.c 88gui/skin_engine/skin_display.c
89gui/skin_engine/wps_parser.c 89gui/skin_engine/wps_parser.c
90gui/skin_engine/wps_tokens.c 90gui/skin_engine/skin_tokens.c
91 91
92#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 92#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
93gui/backdrop.c 93gui/backdrop.c
diff --git a/apps/gui/skin_engine/wps_display.c b/apps/gui/skin_engine/skin_display.c
index 6a94c6a946..bf342116a6 100644
--- a/apps/gui/skin_engine/wps_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -65,9 +65,50 @@
65#include "wps_internals.h" 65#include "wps_internals.h"
66#include "skin_engine.h" 66#include "skin_engine.h"
67 67
68static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode); 68static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode);
69 69
70 70
71#ifdef HAVE_LCD_BITMAP
72/* Clear the WPS image cache */
73static void wps_images_clear(struct wps_data *data)
74{
75 int i;
76 /* set images to unloaded and not displayed */
77 for (i = 0; i < MAX_IMAGES; i++)
78 {
79 data->img[i].loaded = false;
80 data->img[i].display = -1;
81 data->img[i].always_display = false;
82 data->img[i].num_subimages = 1;
83 }
84}
85#endif
86
87/* initial setup of wps_data */
88void skin_data_init(struct wps_data *wps_data)
89{
90#ifdef HAVE_LCD_BITMAP
91 wps_images_clear(wps_data);
92 wps_data->wps_sb_tag = false;
93 wps_data->show_sb_on_wps = false;
94 wps_data->img_buf_ptr = wps_data->img_buf; /* where in image buffer */
95 wps_data->img_buf_free = IMG_BUFSIZE; /* free space in image buffer */
96 wps_data->peak_meter_enabled = false;
97 /* progress bars */
98 wps_data->progressbar_count = 0;
99#else /* HAVE_LCD_CHARCELLS */
100 int i;
101 for (i = 0; i < 8; i++)
102 {
103 wps_data->wps_progress_pat[i] = 0;
104 }
105 wps_data->full_line_progressbar = false;
106#endif
107 wps_data->button_time_volume = 0;
108 wps_data->wps_loaded = false;
109}
110
111/* TODO: maybe move this whole function into wps.c instead ? */
71bool gui_wps_display(struct gui_wps *gwps) 112bool gui_wps_display(struct gui_wps *gwps)
72{ 113{
73 struct screen *display = gwps->display; 114 struct screen *display = gwps->display;
@@ -83,7 +124,7 @@ bool gui_wps_display(struct gui_wps *gwps)
83#endif 124#endif
84 display->clear_display(); 125 display->clear_display();
85 display->backdrop_show(BACKDROP_SKIN_WPS); 126 display->backdrop_show(BACKDROP_SKIN_WPS);
86 return gui_wps_redraw(gwps, WPS_REFRESH_ALL); 127 return skin_redraw(gwps, WPS_REFRESH_ALL);
87} 128}
88 129
89/* update a skinned screen, update_type is WPS_REFRESH_* values. 130/* update a skinned screen, update_type is WPS_REFRESH_* values.
@@ -100,7 +141,7 @@ bool skin_update(struct gui_wps *gwps, unsigned int update_type)
100 bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); 141 bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false);
101 gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update; 142 gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update;
102 143
103 retval = gui_wps_redraw(gwps, gwps->state->do_full_update ? 144 retval = skin_redraw(gwps, gwps->state->do_full_update ?
104 WPS_REFRESH_ALL : update_type); 145 WPS_REFRESH_ALL : update_type);
105 return retval; 146 return retval;
106} 147}
@@ -338,6 +379,41 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
338 379
339#endif /* HAVE_LCD_CHARCELL */ 380#endif /* HAVE_LCD_CHARCELL */
340 381
382/* Returns the index of the subline in the subline array
383 line - 0-based line number
384 subline - 0-based subline number within the line
385 */
386static int subline_index(struct wps_data *data, int line, int subline)
387{
388 return data->lines[line].first_subline_idx + subline;
389}
390
391/* Returns the index of the first subline's token in the token array
392 line - 0-based line number
393 subline - 0-based subline number within the line
394 */
395static int first_token_index(struct wps_data *data, int line, int subline)
396{
397 int first_subline_idx = data->lines[line].first_subline_idx;
398 return data->sublines[first_subline_idx + subline].first_token_idx;
399}
400
401int skin_last_token_index(struct wps_data *data, int line, int subline)
402{
403 int first_subline_idx = data->lines[line].first_subline_idx;
404 int idx = first_subline_idx + subline;
405 if (idx < data->num_sublines - 1)
406 {
407 /* This subline ends where the next begins */
408 return data->sublines[idx+1].first_token_idx - 1;
409 }
410 else
411 {
412 /* The last subline goes to the end */
413 return data->num_tokens - 1;
414 }
415}
416
341/* Return the index to the end token for the conditional token at index. 417/* Return the index to the end token for the conditional token at index.
342 The conditional token can be either a start token or a separator 418 The conditional token can be either a start token or a separator
343 (i.e. option) token. 419 (i.e. option) token.
@@ -448,8 +524,8 @@ static bool get_line(struct gui_wps *gwps,
448 align->right = NULL; 524 align->right = NULL;
449 525
450 /* Process all tokens of the desired subline */ 526 /* Process all tokens of the desired subline */
451 last_token_idx = wps_last_token_index(data, line, subline); 527 last_token_idx = skin_last_token_index(data, line, subline);
452 for (i = wps_first_token_index(data, line, subline); 528 for (i = first_token_index(data, line, subline);
453 i <= last_token_idx; i++) 529 i <= last_token_idx; i++)
454 { 530 {
455 switch(data->tokens[i].type) 531 switch(data->tokens[i].type)
@@ -571,12 +647,12 @@ static void get_subline_timeout(struct gui_wps *gwps, int line, int subline)
571{ 647{
572 struct wps_data *data = gwps->data; 648 struct wps_data *data = gwps->data;
573 int i; 649 int i;
574 int subline_idx = wps_subline_index(data, line, subline); 650 int subline_idx = subline_index(data, line, subline);
575 int last_token_idx = wps_last_token_index(data, line, subline); 651 int last_token_idx = skin_last_token_index(data, line, subline);
576 652
577 data->sublines[subline_idx].time_mult = DEFAULT_SUBLINE_TIME_MULTIPLIER; 653 data->sublines[subline_idx].time_mult = DEFAULT_SUBLINE_TIME_MULTIPLIER;
578 654
579 for (i = wps_first_token_index(data, line, subline); 655 for (i = first_token_index(data, line, subline);
580 i <= last_token_idx; i++) 656 i <= last_token_idx; i++)
581 { 657 {
582 switch(data->tokens[i].type) 658 switch(data->tokens[i].type)
@@ -658,7 +734,7 @@ static bool update_curr_subline(struct gui_wps *gwps, int line)
658 /* get initial time multiplier for this subline */ 734 /* get initial time multiplier for this subline */
659 get_subline_timeout(gwps, line, data->lines[line].curr_subline); 735 get_subline_timeout(gwps, line, data->lines[line].curr_subline);
660 736
661 int subline_idx = wps_subline_index(data, line, 737 int subline_idx = subline_index(data, line,
662 data->lines[line].curr_subline); 738 data->lines[line].curr_subline);
663 739
664 /* only use this subline if subline time > 0 */ 740 /* only use this subline if subline time > 0 */
@@ -839,7 +915,7 @@ static void write_line(struct screen *display,
839 } 915 }
840} 916}
841 917
842static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode) 918static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
843{ 919{
844 struct wps_data *data = gwps->data; 920 struct wps_data *data = gwps->data;
845 struct screen *display = gwps->display; 921 struct screen *display = gwps->display;
@@ -950,7 +1026,7 @@ static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode)
950 /* get current subline for the line */ 1026 /* get current subline for the line */
951 new_subline_refresh = update_curr_subline(gwps, line); 1027 new_subline_refresh = update_curr_subline(gwps, line);
952 1028
953 subline_idx = wps_subline_index(data, line, 1029 subline_idx = subline_index(data, line,
954 data->lines[line].curr_subline); 1030 data->lines[line].curr_subline);
955 flags = data->sublines[subline_idx].line_type; 1031 flags = data->sublines[subline_idx].line_type;
956 1032
diff --git a/apps/gui/skin_engine/wps_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index b1163aa88a..b1163aa88a 100644
--- a/apps/gui/skin_engine/wps_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
diff --git a/apps/gui/skin_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index a89f61af9d..02a2cc3de9 100644
--- a/apps/gui/skin_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
@@ -531,7 +531,7 @@ static void print_line_info(struct wps_data *data)
531 { 531 {
532 DEBUGF(" Subline %d: first_token=%3d, last_token=%3d", 532 DEBUGF(" Subline %d: first_token=%3d, last_token=%3d",
533 j, subline->first_token_idx, 533 j, subline->first_token_idx,
534 wps_last_token_index(data, i, j)); 534 skin_last_token_index(data, i, j));
535 535
536 if (subline->line_type & WPS_REFRESH_SCROLL) 536 if (subline->line_type & WPS_REFRESH_SCROLL)
537 DEBUGF(", scrolled"); 537 DEBUGF(", scrolled");
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index c00a4f1945..a64ec93f08 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -474,23 +474,11 @@ struct wps_data
474/* Redraw statusbars if necessary */ 474/* Redraw statusbars if necessary */
475void gwps_draw_statusbars(void); 475void gwps_draw_statusbars(void);
476 476
477/* Returns the index of the subline in the subline array
478 line - 0-based line number
479 subline - 0-based subline number within the line
480 */
481int wps_subline_index(struct wps_data *wps_data, int line, int subline);
482
483/* Returns the index of the first subline's token in the token array
484 line - 0-based line number
485 subline - 0-based subline number within the line
486 */
487int wps_first_token_index(struct wps_data *data, int line, int subline);
488
489/* Returns the index of the last subline's token in the token array. 477/* Returns the index of the last subline's token in the token array.
490 line - 0-based line number 478 line - 0-based line number
491 subline - 0-based subline number within the line 479 subline - 0-based subline number within the line
492 */ 480 */
493int wps_last_token_index(struct wps_data *data, int line, int subline); 481int skin_last_token_index(struct wps_data *data, int line, int subline);
494 482
495/* wps_data end */ 483/* wps_data end */
496 484
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index c37cd786ec..440133327a 100644
--- a/apps/gui/skin_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -44,6 +44,7 @@
44#include "font.h" 44#include "font.h"
45 45
46#include "wps_internals.h" 46#include "wps_internals.h"
47#include "skin_engine.h"
47#include "settings.h" 48#include "settings.h"
48#include "settings_list.h" 49#include "settings_list.h"
49 50
@@ -1535,46 +1536,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
1535 return (fail == 0); 1536 return (fail == 0);
1536} 1537}
1537 1538
1538#ifdef HAVE_LCD_BITMAP
1539/* Clear the WPS image cache */
1540static void wps_images_clear(struct wps_data *data)
1541{
1542 int i;
1543 /* set images to unloaded and not displayed */
1544 for (i = 0; i < MAX_IMAGES; i++)
1545 {
1546 data->img[i].loaded = false;
1547 data->img[i].display = -1;
1548 data->img[i].always_display = false;
1549 data->img[i].num_subimages = 1;
1550 }
1551}
1552#endif
1553
1554/* initial setup of wps_data */
1555void skin_data_init(struct wps_data *wps_data)
1556{
1557#ifdef HAVE_LCD_BITMAP
1558 wps_images_clear(wps_data);
1559 wps_data->wps_sb_tag = false;
1560 wps_data->show_sb_on_wps = false;
1561 wps_data->img_buf_ptr = wps_data->img_buf; /* where in image buffer */
1562 wps_data->img_buf_free = IMG_BUFSIZE; /* free space in image buffer */
1563 wps_data->peak_meter_enabled = false;
1564 /* progress bars */
1565 wps_data->progressbar_count = 0;
1566#else /* HAVE_LCD_CHARCELLS */
1567 int i;
1568 for (i = 0; i < 8; i++)
1569 {
1570 wps_data->wps_progress_pat[i] = 0;
1571 }
1572 wps_data->full_line_progressbar = false;
1573#endif
1574 wps_data->button_time_volume = 0;
1575 wps_data->wps_loaded = false;
1576}
1577
1578static void wps_reset(struct wps_data *data) 1539static void wps_reset(struct wps_data *data)
1579{ 1540{
1580#ifdef HAVE_REMOTE_LCD 1541#ifdef HAVE_REMOTE_LCD
@@ -1589,7 +1550,7 @@ static void wps_reset(struct wps_data *data)
1589 1550
1590#ifdef HAVE_LCD_BITMAP 1551#ifdef HAVE_LCD_BITMAP
1591 1552
1592static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) 1553static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
1593{ 1554{
1594 char img_path[MAX_PATH]; 1555 char img_path[MAX_PATH];
1595 struct bitmap *bitmap; 1556 struct bitmap *bitmap;
@@ -1780,7 +1741,7 @@ bool skin_data_load(struct wps_data *wps_data,
1780 strlcpy(bmpdir, buf, dot - buf + 1); 1741 strlcpy(bmpdir, buf, dot - buf + 1);
1781 1742
1782 /* load the bitmaps that were found by the parsing */ 1743 /* load the bitmaps that were found by the parsing */
1783 if (!load_wps_bitmaps(wps_data, bmpdir)) { 1744 if (!load_skin_bitmaps(wps_data, bmpdir)) {
1784 wps_reset(wps_data); 1745 wps_reset(wps_data);
1785 return false; 1746 return false;
1786 } 1747 }
@@ -1803,31 +1764,3 @@ bool skin_data_load(struct wps_data *wps_data,
1803 return true; 1764 return true;
1804 } 1765 }
1805} 1766}
1806
1807
1808int wps_subline_index(struct wps_data *data, int line, int subline)
1809{
1810 return data->lines[line].first_subline_idx + subline;
1811}
1812
1813int wps_first_token_index(struct wps_data *data, int line, int subline)
1814{
1815 int first_subline_idx = data->lines[line].first_subline_idx;
1816 return data->sublines[first_subline_idx + subline].first_token_idx;
1817}
1818
1819int wps_last_token_index(struct wps_data *data, int line, int subline)
1820{
1821 int first_subline_idx = data->lines[line].first_subline_idx;
1822 int idx = first_subline_idx + subline;
1823 if (idx < data->num_sublines - 1)
1824 {
1825 /* This subline ends where the next begins */
1826 return data->sublines[idx+1].first_token_idx - 1;
1827 }
1828 else
1829 {
1830 /* The last subline goes to the end */
1831 return data->num_tokens - 1;
1832 }
1833}