diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-04-01 17:32:12 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-04-01 17:32:12 +0000 |
commit | 2684e367242398fc3482d9cc6d59fbed9a43e279 (patch) | |
tree | 869db44c878254a536afa422b17faa046f660eef /apps/gui | |
parent | 6dbcceb1fef9c3c6b4ec186543ab7ce6e8647df1 (diff) | |
download | rockbox-2684e367242398fc3482d9cc6d59fbed9a43e279.tar.gz rockbox-2684e367242398fc3482d9cc6d59fbed9a43e279.zip |
Repair player progressbars (single char and full line) broken in the full unicode support move, and enable text alignment for charcell.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12993 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/gwps-common.c | 41 | ||||
-rw-r--r-- | apps/gui/gwps.h | 2 |
2 files changed, 16 insertions, 27 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 16dfe59ff2..bce213ab4d 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "settings.h" | 25 | #include "settings.h" |
26 | #include "rbunicode.h" | ||
26 | #include "rtc.h" | 27 | #include "rtc.h" |
27 | #include "audio.h" | 28 | #include "audio.h" |
28 | #include "status.h" | 29 | #include "status.h" |
@@ -597,8 +598,8 @@ static char* get_tag(struct wps_data* wps_data, | |||
597 | case 'b': /* progress bar */ | 598 | case 'b': /* progress bar */ |
598 | *flags |= WPS_REFRESH_PLAYER_PROGRESS; | 599 | *flags |= WPS_REFRESH_PLAYER_PROGRESS; |
599 | #ifdef HAVE_LCD_CHARCELLS | 600 | #ifdef HAVE_LCD_CHARCELLS |
600 | snprintf(buf, buf_size, "%c", | 601 | char *end = utf8encode(wps_data->wps_progress_pat[0], buf); |
601 | wps_data->wps_progress_pat[0]); | 602 | *end = '\0'; |
602 | wps_data->full_line_progressbar=0; | 603 | wps_data->full_line_progressbar=0; |
603 | return buf; | 604 | return buf; |
604 | #else | 605 | #else |
@@ -1793,14 +1794,12 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
1793 | new_subline_refresh) | 1794 | new_subline_refresh) |
1794 | { | 1795 | { |
1795 | flags = 0; | 1796 | flags = 0; |
1796 | #ifdef HAVE_LCD_BITMAP | ||
1797 | int left_width, left_xpos; | 1797 | int left_width, left_xpos; |
1798 | int center_width, center_xpos; | 1798 | int center_width, center_xpos; |
1799 | int right_width, right_xpos; | 1799 | int right_width, right_xpos; |
1800 | int space_width; | 1800 | int space_width; |
1801 | int string_height; | 1801 | int string_height; |
1802 | int ypos; | 1802 | int ypos; |
1803 | #endif | ||
1804 | 1803 | ||
1805 | format_display(gwps, buf, sizeof(buf), | 1804 | format_display(gwps, buf, sizeof(buf), |
1806 | state->id3, state->nid3, | 1805 | state->id3, state->nid3, |
@@ -1883,7 +1882,6 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
1883 | draw_player_progress(gwps); | 1882 | draw_player_progress(gwps); |
1884 | } | 1883 | } |
1885 | #endif | 1884 | #endif |
1886 | #ifdef HAVE_LCD_BITMAP | ||
1887 | /* calculate different string sizes and positions */ | 1885 | /* calculate different string sizes and positions */ |
1888 | display->getstringsize((unsigned char *)" ", &space_width, &string_height); | 1886 | display->getstringsize((unsigned char *)" ", &space_width, &string_height); |
1889 | if (format_align.left != 0) { | 1887 | if (format_align.left != 0) { |
@@ -1996,30 +1994,29 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
1996 | right_width = 0; | 1994 | right_width = 0; |
1997 | } | 1995 | } |
1998 | 1996 | ||
1999 | #endif | ||
2000 | |||
2001 | if (flags & WPS_REFRESH_SCROLL) { | 1997 | if (flags & WPS_REFRESH_SCROLL) { |
2002 | 1998 | ||
2003 | /* scroll line */ | 1999 | /* scroll line */ |
2004 | if ((refresh_mode & WPS_REFRESH_SCROLL) || | 2000 | if ((refresh_mode & WPS_REFRESH_SCROLL) || |
2005 | new_subline_refresh) { | 2001 | new_subline_refresh) { |
2006 | #ifdef HAVE_LCD_BITMAP | 2002 | |
2007 | ypos = (i*string_height)+display->getymargin(); | 2003 | ypos = (i*string_height)+display->getymargin(); |
2008 | update_line = true; | 2004 | update_line = true; |
2009 | 2005 | ||
2010 | if (left_width>display->width) { | 2006 | if (left_width>display->width) { |
2011 | display->puts_scroll(0, i, | 2007 | display->puts_scroll(0, i, |
2012 | (unsigned char *)format_align.left); | 2008 | (unsigned char *)format_align.left); |
2013 | } else { | 2009 | } else { |
2014 | /* clear the line first */ | 2010 | /* clear the line first */ |
2011 | #ifdef HAVE_LCD_BITMAP | ||
2015 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 2012 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
2016 | display->fillrect(0, ypos, display->width, string_height); | 2013 | display->fillrect(0, ypos, display->width, string_height); |
2017 | display->set_drawmode(DRMODE_SOLID); | 2014 | display->set_drawmode(DRMODE_SOLID); |
2018 | 2015 | #endif | |
2019 | /* Nasty hack: we output an empty scrolling string, | 2016 | /* Nasty hack: we output an empty scrolling string, |
2020 | which will reset the scroller for that line */ | 2017 | which will reset the scroller for that line */ |
2021 | display->puts_scroll(0, i, (unsigned char *)""); | 2018 | display->puts_scroll(0, i, (unsigned char *)""); |
2022 | 2019 | ||
2023 | /* print aligned strings */ | 2020 | /* print aligned strings */ |
2024 | if (left_width != 0) | 2021 | if (left_width != 0) |
2025 | { | 2022 | { |
@@ -2037,10 +2034,6 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
2037 | (unsigned char *)format_align.right); | 2034 | (unsigned char *)format_align.right); |
2038 | } | 2035 | } |
2039 | } | 2036 | } |
2040 | #else | ||
2041 | display->puts_scroll(0, i, buf); | ||
2042 | update_line = true; | ||
2043 | #endif | ||
2044 | } | 2037 | } |
2045 | } | 2038 | } |
2046 | else if (flags & (WPS_REFRESH_DYNAMIC | WPS_REFRESH_STATIC)) | 2039 | else if (flags & (WPS_REFRESH_DYNAMIC | WPS_REFRESH_STATIC)) |
@@ -2049,14 +2042,15 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
2049 | if ((refresh_mode & (WPS_REFRESH_DYNAMIC|WPS_REFRESH_STATIC)) || | 2042 | if ((refresh_mode & (WPS_REFRESH_DYNAMIC|WPS_REFRESH_STATIC)) || |
2050 | new_subline_refresh) | 2043 | new_subline_refresh) |
2051 | { | 2044 | { |
2052 | #ifdef HAVE_LCD_BITMAP | ||
2053 | ypos = (i*string_height)+display->getymargin(); | 2045 | ypos = (i*string_height)+display->getymargin(); |
2054 | update_line = true; | 2046 | update_line = true; |
2055 | 2047 | ||
2048 | #ifdef HAVE_LCD_BITMAP | ||
2056 | /* clear the line first */ | 2049 | /* clear the line first */ |
2057 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 2050 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
2058 | display->fillrect(0, ypos, display->width, string_height); | 2051 | display->fillrect(0, ypos, display->width, string_height); |
2059 | display->set_drawmode(DRMODE_SOLID); | 2052 | display->set_drawmode(DRMODE_SOLID); |
2053 | #endif | ||
2060 | 2054 | ||
2061 | /* Nasty hack: we output an empty scrolling string, | 2055 | /* Nasty hack: we output an empty scrolling string, |
2062 | which will reset the scroller for that line */ | 2056 | which will reset the scroller for that line */ |
@@ -2078,10 +2072,6 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
2078 | display->putsxy(right_xpos, ypos, | 2072 | display->putsxy(right_xpos, ypos, |
2079 | (unsigned char *)format_align.right); | 2073 | (unsigned char *)format_align.right); |
2080 | } | 2074 | } |
2081 | #else | ||
2082 | update_line = true; | ||
2083 | display->puts(0, i, buf); | ||
2084 | #endif | ||
2085 | } | 2075 | } |
2086 | } | 2076 | } |
2087 | } | 2077 | } |
@@ -2213,7 +2203,7 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size) | |||
2213 | int digits[6]; | 2203 | int digits[6]; |
2214 | int time; | 2204 | int time; |
2215 | char timestr[7]; | 2205 | char timestr[7]; |
2216 | 2206 | ||
2217 | struct wps_state *state = gwps->state; | 2207 | struct wps_state *state = gwps->state; |
2218 | struct screen *display = gwps->display; | 2208 | struct screen *display = gwps->display; |
2219 | struct wps_data *data = gwps->data; | 2209 | struct wps_data *data = gwps->data; |
@@ -2280,8 +2270,7 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size) | |||
2280 | 2270 | ||
2281 | display->define_pattern(data->wps_progress_pat[lcd_char_pos+1], | 2271 | display->define_pattern(data->wps_progress_pat[lcd_char_pos+1], |
2282 | player_progressbar); | 2272 | player_progressbar); |
2283 | buf[lcd_char_pos]=data->wps_progress_pat[lcd_char_pos+1]; | 2273 | buf = utf8encode(data->wps_progress_pat[lcd_char_pos+1], buf); |
2284 | |||
2285 | } | 2274 | } |
2286 | 2275 | ||
2287 | /* make rest of the progressbar if necessary */ | 2276 | /* make rest of the progressbar if necessary */ |
@@ -2289,7 +2278,7 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size) | |||
2289 | 2278 | ||
2290 | /* set the characters positions that use the full 5 pixel wide bar */ | 2279 | /* set the characters positions that use the full 5 pixel wide bar */ |
2291 | for (lcd_char_pos=6; lcd_char_pos < (songpos/5); lcd_char_pos++) | 2280 | for (lcd_char_pos=6; lcd_char_pos < (songpos/5); lcd_char_pos++) |
2292 | buf[lcd_char_pos] = 0x86; /* '_' */ | 2281 | buf = utf8encode(0xe115, buf); /* 2/7 '_' */ |
2293 | 2282 | ||
2294 | /* build the partial bar character for the tail character position */ | 2283 | /* build the partial bar character for the tail character position */ |
2295 | memset(binline, 0, sizeof binline); | 2284 | memset(binline, 0, sizeof binline); |
@@ -2311,8 +2300,8 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size) | |||
2311 | } | 2300 | } |
2312 | 2301 | ||
2313 | display->define_pattern(data->wps_progress_pat[7],player_progressbar); | 2302 | display->define_pattern(data->wps_progress_pat[7],player_progressbar); |
2314 | 2303 | buf = utf8encode(data->wps_progress_pat[7], buf); | |
2315 | buf[songpos/5]=data->wps_progress_pat[7]; | 2304 | *buf = '\0'; |
2316 | } | 2305 | } |
2317 | } | 2306 | } |
2318 | #endif | 2307 | #endif |
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index e19bffc0b1..123bb8fa7c 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -94,7 +94,7 @@ struct wps_data | |||
94 | bool show_sb_on_wps; | 94 | bool show_sb_on_wps; |
95 | #endif | 95 | #endif |
96 | #ifdef HAVE_LCD_CHARCELLS | 96 | #ifdef HAVE_LCD_CHARCELLS |
97 | unsigned char wps_progress_pat[8]; | 97 | unsigned short wps_progress_pat[8]; |
98 | bool full_line_progressbar; | 98 | bool full_line_progressbar; |
99 | #endif | 99 | #endif |
100 | char format_buffer[FORMAT_BUFFER_SIZE]; | 100 | char format_buffer[FORMAT_BUFFER_SIZE]; |