summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_display.c8
-rw-r--r--apps/gui/skin_engine/skin_display.h5
-rw-r--r--apps/gui/skin_engine/skin_parser.c32
-rw-r--r--apps/gui/skin_engine/skin_render.c26
-rw-r--r--apps/gui/skin_engine/skin_tokens.c12
-rw-r--r--apps/gui/skin_engine/wps_internals.h1
6 files changed, 75 insertions, 9 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 2be5bb9106..49f9f86133 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -42,6 +42,7 @@
#include "playlist.h"
#include "audio.h"
#include "tagcache.h"
+#include "list.h"
#ifdef HAVE_LCD_BITMAP
#include "peakmeter.h"
@@ -169,6 +170,13 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
length = MAX_PEAK;
end = peak_meter_scale_value(val, length);
}
+ else if (pb->type == SKIN_TOKEN_LIST_SCROLLBAR)
+ {
+ int val, min, max;
+ skinlist_get_scrollbar(&val, &min, &max);
+ end = val - min;
+ length = max - min;
+ }
#if CONFIG_TUNER
else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
{
diff --git a/apps/gui/skin_engine/skin_display.h b/apps/gui/skin_engine/skin_display.h
index 9faaea30cf..81d04e5a60 100644
--- a/apps/gui/skin_engine/skin_display.h
+++ b/apps/gui/skin_engine/skin_display.h
@@ -36,6 +36,11 @@ void draw_playlist_viewer_list(struct gui_wps *gwps, struct playlistviewer *view
void clear_image_pos(struct gui_wps *gwps, struct gui_img *img);
void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage);
void wps_display_images(struct gui_wps *gwps, struct viewport* vp);
+
+
+void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
+ struct skin_viewport* skin_viewport, unsigned long refresh_type);
+
#endif
/* Evaluate the conditional that is at *token_index and return whether a skip
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 58ac5f552c..049c117af3 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -483,6 +483,32 @@ static int parse_viewport_gradient_setup(struct skin_element *element,
}
#endif
+
+static int parse_listitemviewport(struct skin_element *element,
+ struct wps_token *token,
+ struct wps_data *wps_data)
+{
+ struct listitem_viewport_cfg *cfg =
+ (struct listitem_viewport_cfg *)skin_buffer_alloc(
+ sizeof(struct listitem_viewport_cfg));
+ if (!cfg)
+ return -1;
+ cfg->data = wps_data;
+ cfg->tile = false;
+ cfg->label = element->params[0].data.text;
+ cfg->width = -1;
+ cfg->height = -1;
+ if (!isdefault(&element->params[1]))
+ cfg->width = element->params[1].data.number;
+ if (!isdefault(&element->params[2]))
+ cfg->height = element->params[2].data.number;
+ if (element->params_count > 3 &&
+ !strcmp(element->params[3].data.text, "tile"))
+ cfg->tile = true;
+ token->value.data = (void*)cfg;
+ return 0;
+}
+
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
static int parse_viewporttextstyle(struct skin_element *element,
struct wps_token *token,
@@ -877,6 +903,8 @@ static int parse_progressbar_tag(struct skin_element* element,
token->type = SKIN_TOKEN_PEAKMETER_LEFTBAR;
else if (token->type == SKIN_TOKEN_PEAKMETER_RIGHT)
token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR;
+ else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR)
+ token->type = SKIN_TOKEN_LIST_SCROLLBAR;
pb->type = token->type;
return 0;
@@ -1719,6 +1747,7 @@ static int skin_element_callback(struct skin_element* element, void* data)
case SKIN_TOKEN_PLAYER_PROGRESSBAR:
case SKIN_TOKEN_PEAKMETER_LEFT:
case SKIN_TOKEN_PEAKMETER_RIGHT:
+ case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR:
#ifdef HAVE_RADIO_RSSI
case SKIN_TOKEN_TUNER_RSSI:
#endif
@@ -1809,6 +1838,9 @@ static int skin_element_callback(struct skin_element* element, void* data)
function = parse_skinvar;
break;
#endif
+ case SKIN_TOKEN_LIST_ITEM_CFG:
+ function = parse_listitemviewport;
+ break;
default:
break;
}
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index 27e6747c29..dd266b1ee6 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -46,6 +46,7 @@
#include "playlist.h"
#include "root_menu.h"
#include "misc.h"
+#include "list.h"
#define MAX_LINE 1024
@@ -142,6 +143,11 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
}
}
break;
+ case SKIN_TOKEN_LIST_ITEM_CFG:
+ if (do_refresh)
+ skinlist_set_cfg(gwps->display->screen_type,
+ token->value.data);
+ break;
#ifdef HAVE_LCD_BITMAP
case SKIN_TOKEN_UIVIEWPORT_ENABLE:
sb_set_info_vp(gwps->display->screen_type,
@@ -164,6 +170,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
#ifdef HAVE_LCD_BITMAP
case SKIN_TOKEN_PROGRESSBAR:
case SKIN_TOKEN_TUNER_RSSI_BAR:
+ case SKIN_TOKEN_LIST_SCROLLBAR:
{
struct progressbar *bar = (struct progressbar*)token->value.data;
if (do_refresh)
@@ -488,10 +495,10 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
if (!do_non_text_tags(info->gwps, info, child, &info->skin_vp->vp))
{
static char tempbuf[128];
- const char *value = get_token_value(info->gwps, child->data,
+ const char *valuestr = get_token_value(info->gwps, child->data,
info->offset, tempbuf,
sizeof(tempbuf), NULL);
- if (value)
+ if (valuestr)
{
#if CONFIG_RTC
if (child->tag->flags&SKIN_RTC_REFRESH)
@@ -499,7 +506,7 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
#endif
needs_update = needs_update ||
((child->tag->flags&info->refresh_type)!=0);
- strlcat(info->cur_align_start, value,
+ strlcat(info->cur_align_start, valuestr,
info->buf_size - (info->cur_align_start-info->buf));
}
}
@@ -612,8 +619,8 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
return changed_lines || ret;
}
-static void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
- struct skin_viewport* skin_viewport, unsigned long refresh_type)
+void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
+ struct skin_viewport* skin_viewport, unsigned long refresh_type)
{
struct screen *display = gwps->display;
char linebuf[MAX_LINE];
@@ -784,10 +791,11 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
}
#ifdef HAVE_LCD_BITMAP
-static __attribute__((noinline)) void skin_render_playlistviewer(struct playlistviewer* viewer,
- struct gui_wps *gwps,
- struct skin_viewport* skin_viewport,
- unsigned long refresh_type)
+static __attribute__((noinline))
+void skin_render_playlistviewer(struct playlistviewer* viewer,
+ struct gui_wps *gwps,
+ struct skin_viewport* skin_viewport,
+ unsigned long refresh_type)
{
struct screen *display = gwps->display;
char linebuf[MAX_LINE];
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index ec6f606938..8e15ddc84a 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -71,6 +71,7 @@
#include "radio.h"
#include "tuner.h"
#endif
+#include "list.h"
#define NOINLINE __attribute__ ((noinline))
@@ -894,6 +895,17 @@ const char *get_token_value(struct gui_wps *gwps,
*intval = sb_get_icon(gwps->display->screen_type);
snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type));
return buf;
+ case SKIN_TOKEN_LIST_ITEM_TEXT:
+ return skinlist_get_item_text();
+ case SKIN_TOKEN_LIST_ITEM_IS_SELECTED:
+ return skinlist_is_selected_item()?"s":"";
+ case SKIN_TOKEN_LIST_ITEM_ICON:
+ if (intval)
+ *intval = skinlist_get_item_icon();
+ snprintf(buf, buf_size, "%d",skinlist_get_item_icon());
+ return buf;
+ case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR:
+ return skinlist_needs_scrollbar(gwps->display->screen_type) ? "s" : "";
#endif
case SKIN_TOKEN_PLAYLIST_NAME:
return playlist_name(NULL, buf, buf_size);
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 01f67d4a0b..136ec2921a 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -193,6 +193,7 @@ struct viewport_colour {
struct viewport *vp;
unsigned colour;
};
+
#ifdef HAVE_TOUCHSCREEN
struct touchregion {
char* label; /* label to identify this region */