summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/skin_engine/wps_debug.c (renamed from apps/gui/wps_engine/wps_debug.c)0
-rw-r--r--apps/gui/skin_engine/wps_display.c (renamed from apps/gui/wps_engine/wps_display.c)89
-rw-r--r--apps/gui/skin_engine/wps_internals.h (renamed from apps/gui/wps_engine/wps_internals.h)11
-rw-r--r--apps/gui/skin_engine/wps_parser.c (renamed from apps/gui/wps_engine/wps_parser.c)106
-rw-r--r--apps/gui/skin_engine/wps_tokens.c (renamed from apps/gui/wps_engine/wps_tokens.c)2
-rw-r--r--apps/gui/wps_engine/wps_engine.h49
6 files changed, 95 insertions, 162 deletions
diff --git a/apps/gui/wps_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index a89f61af9d..a89f61af9d 100644
--- a/apps/gui/wps_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
diff --git a/apps/gui/wps_engine/wps_display.c b/apps/gui/skin_engine/wps_display.c
index c74e2cedfa..98050093c4 100644
--- a/apps/gui/wps_engine/wps_display.c
+++ b/apps/gui/skin_engine/wps_display.c
@@ -63,89 +63,52 @@
63 63
64 64
65#include "wps_internals.h" 65#include "wps_internals.h"
66#include "wps_engine.h" 66#include "skin_engine.h"
67
68static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode);
69
67 70
68bool gui_wps_display(struct gui_wps *gwps) 71bool gui_wps_display(struct gui_wps *gwps)
69{ 72{
70 struct screen *display = gwps->display; 73 struct screen *display = gwps->display;
71 struct wps_data *data = gwps->data;
72 int screen = display->screen_type;
73 74
74 /* Update the values in the first (default) viewport - in case the user 75 /* Update the values in the first (default) viewport - in case the user
75 has modified the statusbar or colour settings */ 76 has modified the statusbar or colour settings */
76#if LCD_DEPTH > 1 77#if LCD_DEPTH > 1
77 if (display->depth > 1) 78 if (display->depth > 1)
78 { 79 {
79 data->viewports[0].vp.fg_pattern = display->get_foreground(); 80 gwps->data->viewports[0].vp.fg_pattern = display->get_foreground();
80 data->viewports[0].vp.bg_pattern = display->get_background(); 81 gwps->data->viewports[0].vp.bg_pattern = display->get_background();
81 } 82 }
82#endif 83#endif
83 display->clear_display(); 84 display->clear_display();
84 if (!data->wps_loaded) {
85 if ( !data->num_tokens ) {
86 /* set the default wps for the main-screen */
87 if(screen == SCREEN_MAIN)
88 {
89#if LCD_DEPTH > 1
90 unload_wps_backdrop();
91#endif
92 wps_data_load(data,
93 display,
94#ifdef HAVE_LCD_BITMAP
95 "%s%?it<%?in<%in. |>%it|%fn>\n"
96 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
97 "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
98 "\n"
99 "%al%pc/%pt%ar[%pp:%pe]\n"
100 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
101 "%pb\n"
102 "%pm\n", false);
103#else
104 "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
105 "%pc%?ps<*|/>%pt\n", false);
106#endif
107 }
108#ifdef HAVE_REMOTE_LCD
109 /* set the default wps for the remote-screen */
110 else if(screen == SCREEN_REMOTE)
111 {
112#if LCD_REMOTE_DEPTH > 1
113 unload_remote_wps_backdrop();
114#endif
115 wps_data_load(data,
116 display,
117 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
118 "%s%?it<%?in<%in. |>%it|%fn>\n"
119 "%al%pc/%pt%ar[%pp:%pe]\n"
120 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
121 "%pb\n", false);
122 }
123#endif
124 }
125 }
126 else
127 {
128#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 85#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
129 if (screen == SCREEN_REMOTE) 86 if (display->screen_type == SCREEN_REMOTE)
130 show_remote_wps_backdrop(); 87 show_remote_wps_backdrop();
131 else if (screen == SCREEN_MAIN) 88 else if (display->screen_type == SCREEN_MAIN)
132#endif 89#endif
133#if LCD_DEPTH > 1 90#if LCD_DEPTH > 1
134 show_wps_backdrop(); 91 show_wps_backdrop();
135#endif 92#endif
136 } 93 return gui_wps_redraw(gwps, WPS_REFRESH_ALL);
137 return gui_wps_redraw(gwps, 0, WPS_REFRESH_ALL);
138} 94}
139 95
140bool gui_wps_update(struct gui_wps *gwps) 96/* update a skinned screen, update_type is WPS_REFRESH_* values.
97 * Usually it should only be WPS_REFRESH_NON_STATIC
98 * A full update will be done if required (state.do_full_update == true)
99 */
100bool skin_update(struct gui_wps *gwps, unsigned int update_type)
141{ 101{
142 struct mp3entry *id3 = gwps->state->id3;
143 bool retval; 102 bool retval;
103 /* This maybe shouldnt be here, but while the skin is only used to
104 * display the music screen this is better than whereever we are being
105 * called from. This is also safe for skined screen which dont use the id3 */
106 struct mp3entry *id3 = gwps->state->id3;
144 bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); 107 bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false);
145 gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update; 108 gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update;
146 retval = gui_wps_redraw(gwps, 0, 109
147 gwps->state->do_full_update ? 110 retval = gui_wps_redraw(gwps, gwps->state->do_full_update ?
148 WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC); 111 WPS_REFRESH_ALL : update_type);
149 return retval; 112 return retval;
150} 113}
151 114
@@ -883,9 +846,7 @@ static void write_line(struct screen *display,
883 } 846 }
884} 847}
885 848
886bool gui_wps_redraw(struct gui_wps *gwps, 849static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode)
887 int ffwd_offset,
888 unsigned refresh_mode)
889{ 850{
890 struct wps_data *data = gwps->data; 851 struct wps_data *data = gwps->data;
891 struct screen *display = gwps->display; 852 struct screen *display = gwps->display;
@@ -943,8 +904,6 @@ bool gui_wps_redraw(struct gui_wps *gwps,
943 } 904 }
944#endif 905#endif
945 906
946 state->ff_rewind_count = ffwd_offset;
947
948 /* disable any viewports which are conditionally displayed */ 907 /* disable any viewports which are conditionally displayed */
949 for (v = 0; v < data->num_viewports; v++) 908 for (v = 0; v < data->num_viewports; v++)
950 { 909 {
diff --git a/apps/gui/wps_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index ce9b4d3d46..2dcaa504bb 100644
--- a/apps/gui/wps_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -390,11 +390,6 @@ struct touchregion {
390 short int y; /* y-pos */ 390 short int y; /* y-pos */
391 short int width; /* width */ 391 short int width; /* width */
392 short int height; /* height */ 392 short int height; /* height */
393 enum {
394 WPS_TOUCHREGION_ACTION,
395 WPS_TOUCHREGION_SCROLLBAR,
396 WPS_TOUCHREGION_VOLUME
397 } type; /* type of touch region */
398 bool repeat; /* requires the area be held for the action */ 393 bool repeat; /* requires the area be held for the action */
399 int action; /* action this button will return */ 394 int action; /* action this button will return */
400}; 395};
@@ -478,12 +473,6 @@ struct wps_data
478/* initial setup of wps_data */ 473/* initial setup of wps_data */
479void wps_data_init(struct wps_data *wps_data); 474void wps_data_init(struct wps_data *wps_data);
480 475
481/* to setup up the wps-data from a format-buffer (isfile = false)
482 from a (wps-)file (isfile = true)*/
483bool wps_data_load(struct wps_data *wps_data,
484 struct screen *display,
485 const char *buf,
486 bool isfile);
487 476
488/* Redraw statusbars if necessary */ 477/* Redraw statusbars if necessary */
489void gwps_draw_statusbars(void); 478void gwps_draw_statusbars(void);
diff --git a/apps/gui/wps_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index 91c63059b0..a3e5f6861d 100644
--- a/apps/gui/wps_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -1173,8 +1173,6 @@ static int parse_touchregion(const char *wps_bufptr,
1173 struct touchregion *region; 1173 struct touchregion *region;
1174 const char *ptr = wps_bufptr; 1174 const char *ptr = wps_bufptr;
1175 const char *action; 1175 const char *action;
1176 const char pb_string[] = "progressbar";
1177 const char vol_string[] = "volume";
1178 int x,y,w,h; 1176 int x,y,w,h;
1179 1177
1180 /* format: %T|x|y|width|height|action| 1178 /* format: %T|x|y|width|height|action|
@@ -1205,7 +1203,7 @@ static int parse_touchregion(const char *wps_bufptr,
1205 /* Check there is a terminating | */ 1203 /* Check there is a terminating | */
1206 if (*ptr != '|') 1204 if (*ptr != '|')
1207 return WPS_ERROR_INVALID_PARAM; 1205 return WPS_ERROR_INVALID_PARAM;
1208 1206
1209 /* should probably do some bounds checking here with the viewport... but later */ 1207 /* should probably do some bounds checking here with the viewport... but later */
1210 region = &wps_data->touchregion[wps_data->touchregion_count]; 1208 region = &wps_data->touchregion[wps_data->touchregion_count];
1211 region->action = ACTION_NONE; 1209 region->action = ACTION_NONE;
@@ -1214,41 +1212,28 @@ static int parse_touchregion(const char *wps_bufptr,
1214 region->width = w; 1212 region->width = w;
1215 region->height = h; 1213 region->height = h;
1216 region->wvp = &wps_data->viewports[wps_data->num_viewports]; 1214 region->wvp = &wps_data->viewports[wps_data->num_viewports];
1217 1215 i = 0;
1218 if(!strncmp(pb_string, action, sizeof(pb_string)-1) 1216 if (*action == '&')
1219 && *(action + sizeof(pb_string)-1) == '|')
1220 region->type = WPS_TOUCHREGION_SCROLLBAR;
1221 else if(!strncmp(vol_string, action, sizeof(vol_string)-1)
1222 && *(action + sizeof(vol_string)-1) == '|')
1223 region->type = WPS_TOUCHREGION_VOLUME;
1224 else
1225 { 1217 {
1226 region->type = WPS_TOUCHREGION_ACTION; 1218 action++;
1227 1219 region->repeat = true;
1228 if (*action == '&')
1229 {
1230 action++;
1231 region->repeat = true;
1232 }
1233 else
1234 region->repeat = false;
1235
1236 i = 0;
1237 imax = ARRAYLEN(touchactions);
1238 while ((region->action == ACTION_NONE) &&
1239 (i < imax))
1240 {
1241 /* try to match with one of our touchregion screens */
1242 int len = strlen(touchactions[i].s);
1243 if (!strncmp(touchactions[i].s, action, len)
1244 && *(action+len) == '|')
1245 region->action = touchactions[i].action;
1246 i++;
1247 }
1248 if (region->action == ACTION_NONE)
1249 return WPS_ERROR_INVALID_PARAM;
1250 } 1220 }
1221 else
1222 region->repeat = false;
1251 1223
1224 imax = ARRAYLEN(touchactions);
1225 while ((region->action == ACTION_NONE) &&
1226 (i < imax))
1227 {
1228 /* try to match with one of our touchregion screens */
1229 int len = strlen(touchactions[i].s);
1230 if (!strncmp(touchactions[i].s, action, len)
1231 && *(action+len) == '|')
1232 region->action = touchactions[i].action;
1233 i++;
1234 }
1235 if (region->action == ACTION_NONE)
1236 return WPS_ERROR_INVALID_PARAM;
1252 wps_data->touchregion_count++; 1237 wps_data->touchregion_count++;
1253 return skip_end_of_line(wps_bufptr); 1238 return skip_end_of_line(wps_bufptr);
1254} 1239}
@@ -1681,7 +1666,7 @@ static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
1681 1666
1682/* to setup up the wps-data from a format-buffer (isfile = false) 1667/* to setup up the wps-data from a format-buffer (isfile = false)
1683 from a (wps-)file (isfile = true)*/ 1668 from a (wps-)file (isfile = true)*/
1684bool wps_data_load(struct wps_data *wps_data, 1669static bool wps_data_load(struct wps_data *wps_data,
1685 struct screen *display, 1670 struct screen *display,
1686 const char *buf, 1671 const char *buf,
1687 bool isfile) 1672 bool isfile)
@@ -1830,6 +1815,55 @@ bool wps_data_load(struct wps_data *wps_data,
1830 } 1815 }
1831} 1816}
1832 1817
1818void skin_data_load(struct wps_data *wps_data,
1819 struct screen *display,
1820 const char *buf,
1821 bool isfile)
1822{
1823 bool loaded_ok = buf && wps_data_load(wps_data, display, buf, isfile);
1824 if (!loaded_ok) /* load the hardcoded default */
1825 {
1826 /* set the default wps for the main-screen */
1827 if(display->screen_type == SCREEN_MAIN)
1828 {
1829#if LCD_DEPTH > 1
1830 unload_wps_backdrop();
1831#endif
1832 wps_data_load(wps_data,
1833 display,
1834#ifdef HAVE_LCD_BITMAP
1835 "%s%?it<%?in<%in. |>%it|%fn>\n"
1836 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
1837 "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
1838 "\n"
1839 "%al%pc/%pt%ar[%pp:%pe]\n"
1840 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
1841 "%pb\n"
1842 "%pm\n", false);
1843#else
1844 "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
1845 "%pc%?ps<*|/>%pt\n", false);
1846#endif
1847 }
1848#ifdef HAVE_REMOTE_LCD
1849 /* set the default wps for the remote-screen */
1850 else if(display->screen_type == SCREEN_REMOTE)
1851 {
1852#if LCD_REMOTE_DEPTH > 1
1853 unload_remote_wps_backdrop();
1854#endif
1855 wps_data_load(wps_data,
1856 display,
1857 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
1858 "%s%?it<%?in<%in. |>%it|%fn>\n"
1859 "%al%pc/%pt%ar[%pp:%pe]\n"
1860 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
1861 "%pb\n", false);
1862 }
1863#endif
1864 }
1865}
1866
1833int wps_subline_index(struct wps_data *data, int line, int subline) 1867int wps_subline_index(struct wps_data *data, int line, int subline)
1834{ 1868{
1835 return data->lines[line].first_subline_idx + subline; 1869 return data->lines[line].first_subline_idx + subline;
diff --git a/apps/gui/wps_engine/wps_tokens.c b/apps/gui/skin_engine/wps_tokens.c
index 3852251916..b1163aa88a 100644
--- a/apps/gui/wps_engine/wps_tokens.c
+++ b/apps/gui/skin_engine/wps_tokens.c
@@ -55,7 +55,7 @@
55#include "viewport.h" 55#include "viewport.h"
56 56
57#include "wps_internals.h" 57#include "wps_internals.h"
58#include "music_screen.h" 58#include "wps.h"
59 59
60static char* get_codectype(const struct mp3entry* id3) 60static char* get_codectype(const struct mp3entry* id3)
61{ 61{
diff --git a/apps/gui/wps_engine/wps_engine.h b/apps/gui/wps_engine/wps_engine.h
deleted file mode 100644
index fe034f9138..0000000000
--- a/apps/gui/wps_engine/wps_engine.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: gwps.h 22003 2009-07-22 22:10:25Z kugel $
9 *
10 * Copyright (C) 2007 Nicolas Pennequin
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22 /** Use this for stuff which external code needs to include **/
23
24#ifndef _WPS_ENGINE_H
25#define _WPS_ENGINE_H
26#include <stdbool.h>
27#include "wps_internals.h" /* TODO: remove this line.. shoudlnt be needed */
28
29
30#ifdef HAVE_TOUCHSCREEN
31int wps_get_touchaction(struct wps_data *data);
32#endif
33
34#ifdef HAVE_ALBUMART
35/* gives back if WPS contains an albumart tag */
36bool gui_sync_wps_uses_albumart(void);
37#endif
38
39/* setup and display a WPS for the first time */
40bool gui_wps_display(struct gui_wps *gwps);
41/* do a requested redraw */
42bool gui_wps_redraw(struct gui_wps *gwps,
43 int ffwd_offset,
44 unsigned refresh_mode);
45/* do a partial redraw, or full if required, also do any housekeeping
46 * which might be needed */
47bool gui_wps_update(struct gui_wps *gwps);
48
49#endif