summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/gwps-common.c59
-rw-r--r--apps/gui/gwps.h1
2 files changed, 23 insertions, 37 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index adda4403c5..98f2c7e2ed 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1638,6 +1638,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1638 bool reset_subline; 1638 bool reset_subline;
1639 int search; 1639 int search;
1640 int search_start; 1640 int search_start;
1641 struct align_pos format_align;
1641 struct wps_data *data = gwps->data; 1642 struct wps_data *data = gwps->data;
1642 struct wps_state *state = gwps->state; 1643 struct wps_state *state = gwps->state;
1643 struct screen *display = gwps->display; 1644 struct screen *display = gwps->display;
@@ -1738,7 +1739,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1738 format_display(gwps, buf, sizeof(buf), 1739 format_display(gwps, buf, sizeof(buf),
1739 state->id3, state->nid3, 1740 state->id3, state->nid3,
1740 data->format_lines[i][data->curr_subline[i]], 1741 data->format_lines[i][data->curr_subline[i]],
1741 &data->format_align[i][data->curr_subline[i]], 1742 &format_align,
1742 &data->time_mult[i][data->curr_subline[i]], 1743 &data->time_mult[i][data->curr_subline[i]],
1743 &data->line_type[i][data->curr_subline[i]]); 1744 &data->line_type[i][data->curr_subline[i]]);
1744 1745
@@ -1778,7 +1779,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1778 format_display(gwps, buf, sizeof(buf), 1779 format_display(gwps, buf, sizeof(buf),
1779 state->id3, state->nid3, 1780 state->id3, state->nid3,
1780 data->format_lines[i][data->curr_subline[i]], 1781 data->format_lines[i][data->curr_subline[i]],
1781 &data->format_align[i][data->curr_subline[i]], 1782 &format_align,
1782 &data->time_mult[i][data->curr_subline[i]], 1783 &data->time_mult[i][data->curr_subline[i]],
1783 &flags); 1784 &flags);
1784 data->line_type[i][data->curr_subline[i]] = flags; 1785 data->line_type[i][data->curr_subline[i]] = flags;
@@ -1846,9 +1847,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1846#ifdef HAVE_LCD_BITMAP 1847#ifdef HAVE_LCD_BITMAP
1847 /* calculate different string sizes and positions */ 1848 /* calculate different string sizes and positions */
1848 display->getstringsize((unsigned char *)" ", &space_width, &string_height); 1849 display->getstringsize((unsigned char *)" ", &space_width, &string_height);
1849 if (data->format_align[i][data->curr_subline[i]].left != 0) { 1850 if (format_align.left != 0) {
1850 display->getstringsize((unsigned char *)data->format_align[i] 1851 display->getstringsize((unsigned char *)format_align.left,
1851 [data->curr_subline[i]].left,
1852 &left_width, &string_height); 1852 &left_width, &string_height);
1853 } 1853 }
1854 else { 1854 else {
@@ -1856,9 +1856,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1856 } 1856 }
1857 left_xpos = 0; 1857 left_xpos = 0;
1858 1858
1859 if (data->format_align[i][data->curr_subline[i]].center != 0) { 1859 if (format_align.center != 0) {
1860 display->getstringsize((unsigned char *)data->format_align[i] 1860 display->getstringsize((unsigned char *)format_align.center,
1861 [data->curr_subline[i]].center,
1862 &center_width, &string_height); 1861 &center_width, &string_height);
1863 } 1862 }
1864 else { 1863 else {
@@ -1866,9 +1865,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1866 } 1865 }
1867 center_xpos=(display->width - center_width) / 2; 1866 center_xpos=(display->width - center_width) / 2;
1868 1867
1869 if (data->format_align[i][data->curr_subline[i]].right != 0) { 1868 if (format_align.right != 0) {
1870 display->getstringsize((unsigned char *)data->format_align[i] 1869 display->getstringsize((unsigned char *)format_align.right,
1871 [data->curr_subline[i]].right,
1872 &right_width, &string_height); 1870 &right_width, &string_height);
1873 } 1871 }
1874 else { 1872 else {
@@ -1886,7 +1884,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1886 (left_xpos + left_width + space_width > center_xpos)) { 1884 (left_xpos + left_width + space_width > center_xpos)) {
1887 /* replace the former separator '\0' of left and 1885 /* replace the former separator '\0' of left and
1888 center string with a space */ 1886 center string with a space */
1889 *(--data->format_align[i][data->curr_subline[i]].center) = ' '; 1887 *(--format_align.center) = ' ';
1890 /* calculate the new width and position of the merged string */ 1888 /* calculate the new width and position of the merged string */
1891 left_width = left_width + space_width + center_width; 1889 left_width = left_width + space_width + center_width;
1892 left_xpos = 0; 1890 left_xpos = 0;
@@ -1897,8 +1895,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1897 if ((left_width == 0 && center_width != 0) && 1895 if ((left_width == 0 && center_width != 0) &&
1898 (left_xpos + left_width > center_xpos)) { 1896 (left_xpos + left_width > center_xpos)) {
1899 /* move the center string to the left string */ 1897 /* move the center string to the left string */
1900 data->format_align[i][data->curr_subline[i]].left = 1898 format_align.left = format_align.center;
1901 data->format_align[i][data->curr_subline[i]].center;
1902 /* calculate the new width and position of the string */ 1899 /* calculate the new width and position of the string */
1903 left_width = center_width; 1900 left_width = center_width;
1904 left_xpos = 0; 1901 left_xpos = 0;
@@ -1912,10 +1909,9 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1912 (center_xpos + center_width + space_width > right_xpos)) { 1909 (center_xpos + center_width + space_width > right_xpos)) {
1913 /* replace the former separator '\0' of center and 1910 /* replace the former separator '\0' of center and
1914 right string with a space */ 1911 right string with a space */
1915 *(--data->format_align[i][data->curr_subline[i]].right) = ' '; 1912 *(--format_align.right) = ' ';
1916 /* move the center string to the right after merge */ 1913 /* move the center string to the right after merge */
1917 data->format_align[i][data->curr_subline[i]].right = 1914 format_align.right = format_align.center;
1918 data->format_align[i][data->curr_subline[i]].center;
1919 /* calculate the new width and position of the merged string */ 1915 /* calculate the new width and position of the merged string */
1920 right_width = center_width + space_width + right_width; 1916 right_width = center_width + space_width + right_width;
1921 right_xpos = (display->width - right_width); 1917 right_xpos = (display->width - right_width);
@@ -1926,8 +1922,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1926 if ((center_width != 0 && right_width == 0) && 1922 if ((center_width != 0 && right_width == 0) &&
1927 (center_xpos + center_width > right_xpos)) { 1923 (center_xpos + center_width > right_xpos)) {
1928 /* move the center string to the right string */ 1924 /* move the center string to the right string */
1929 data->format_align[i][data->curr_subline[i]].right = 1925 format_align.right = format_align.center;
1930 data->format_align[i][data->curr_subline[i]].center;
1931 /* calculate the new width and position of the string */ 1926 /* calculate the new width and position of the string */
1932 right_width = center_width; 1927 right_width = center_width;
1933 right_xpos = (display->width - right_width); 1928 right_xpos = (display->width - right_width);
@@ -1943,7 +1938,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1943 (left_xpos + left_width + space_width > right_xpos)) { 1938 (left_xpos + left_width + space_width > right_xpos)) {
1944 /* replace the former separator '\0' of left and 1939 /* replace the former separator '\0' of left and
1945 right string with a space */ 1940 right string with a space */
1946 *(--data->format_align[i][data->curr_subline[i]].right) = ' '; 1941 *(--format_align.right) = ' ';
1947 /* calculate the new width and position of the string */ 1942 /* calculate the new width and position of the string */
1948 left_width = left_width + space_width + right_width; 1943 left_width = left_width + space_width + right_width;
1949 left_xpos = 0; 1944 left_xpos = 0;
@@ -1954,8 +1949,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1954 if ((left_width == 0 && center_width == 0 && right_width != 0) && 1949 if ((left_width == 0 && center_width == 0 && right_width != 0) &&
1955 (left_xpos + left_width > right_xpos)) { 1950 (left_xpos + left_width > right_xpos)) {
1956 /* move the right string to the left string */ 1951 /* move the right string to the left string */
1957 data->format_align[i][data->curr_subline[i]].left = 1952 format_align.left = format_align.right;
1958 data->format_align[i][data->curr_subline[i]].right;
1959 /* calculate the new width and position of the string */ 1953 /* calculate the new width and position of the string */
1960 left_width = right_width; 1954 left_width = right_width;
1961 left_xpos = 0; 1955 left_xpos = 0;
@@ -1976,8 +1970,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1976 1970
1977 if (left_width>display->width) { 1971 if (left_width>display->width) {
1978 display->puts_scroll(0, i, 1972 display->puts_scroll(0, i,
1979 (unsigned char *)data->format_align[i] 1973 (unsigned char *)format_align.left);
1980 [data->curr_subline[i]].left);
1981 } else { 1974 } else {
1982 /* clear the line first */ 1975 /* clear the line first */
1983 display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 1976 display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -1992,20 +1985,17 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1992 if (left_width != 0) 1985 if (left_width != 0)
1993 { 1986 {
1994 display->putsxy(left_xpos, ypos, 1987 display->putsxy(left_xpos, ypos,
1995 (unsigned char *)data->format_align[i] 1988 (unsigned char *)format_align.left);
1996 [data->curr_subline[i]].left);
1997 } 1989 }
1998 if (center_width != 0) 1990 if (center_width != 0)
1999 { 1991 {
2000 display->putsxy(center_xpos, ypos, 1992 display->putsxy(center_xpos, ypos,
2001 (unsigned char *)data->format_align[i] 1993 (unsigned char *)format_align.center);
2002 [data->curr_subline[i]].center);
2003 } 1994 }
2004 if (right_width != 0) 1995 if (right_width != 0)
2005 { 1996 {
2006 display->putsxy(right_xpos, ypos, 1997 display->putsxy(right_xpos, ypos,
2007 (unsigned char *)data->format_align[i] 1998 (unsigned char *)format_align.right);
2008 [data->curr_subline[i]].right);
2009 } 1999 }
2010 } 2000 }
2011#else 2001#else
@@ -2037,20 +2027,17 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
2037 if (left_width != 0) 2027 if (left_width != 0)
2038 { 2028 {
2039 display->putsxy(left_xpos, ypos, 2029 display->putsxy(left_xpos, ypos,
2040 (unsigned char *)data->format_align[i] 2030 (unsigned char *)format_align.left);
2041 [data->curr_subline[i]].left);
2042 } 2031 }
2043 if (center_width != 0) 2032 if (center_width != 0)
2044 { 2033 {
2045 display->putsxy(center_xpos, ypos, 2034 display->putsxy(center_xpos, ypos,
2046 (unsigned char *)data->format_align[i] 2035 (unsigned char *)format_align.center);
2047 [data->curr_subline[i]].center);
2048 } 2036 }
2049 if (right_width != 0) 2037 if (right_width != 0)
2050 { 2038 {
2051 display->putsxy(right_xpos, ypos, 2039 display->putsxy(right_xpos, ypos,
2052 (unsigned char *)data->format_align[i] 2040 (unsigned char *)format_align.right);
2053 [data->curr_subline[i]].right);
2054 } 2041 }
2055#else 2042#else
2056 update_line = true; 2043 update_line = true;
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 2c9638d5c9..39ce80845c 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -378,7 +378,6 @@ struct wps_data
378#endif 378#endif
379 char format_buffer[FORMAT_BUFFER_SIZE]; 379 char format_buffer[FORMAT_BUFFER_SIZE];
380 char* format_lines[WPS_MAX_LINES][WPS_MAX_SUBLINES]; 380 char* format_lines[WPS_MAX_LINES][WPS_MAX_SUBLINES];
381 struct align_pos format_align[WPS_MAX_LINES][WPS_MAX_SUBLINES];
382 unsigned char line_type[WPS_MAX_LINES][WPS_MAX_SUBLINES]; 381 unsigned char line_type[WPS_MAX_LINES][WPS_MAX_SUBLINES];
383 unsigned short time_mult[WPS_MAX_LINES][WPS_MAX_SUBLINES]; 382 unsigned short time_mult[WPS_MAX_LINES][WPS_MAX_SUBLINES];
384 long subline_expire_time[WPS_MAX_LINES]; 383 long subline_expire_time[WPS_MAX_LINES];