summaryrefslogtreecommitdiff
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 @@
42#include "playlist.h" 42#include "playlist.h"
43#include "audio.h" 43#include "audio.h"
44#include "tagcache.h" 44#include "tagcache.h"
45#include "list.h"
45 46
46#ifdef HAVE_LCD_BITMAP 47#ifdef HAVE_LCD_BITMAP
47#include "peakmeter.h" 48#include "peakmeter.h"
@@ -169,6 +170,13 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
169 length = MAX_PEAK; 170 length = MAX_PEAK;
170 end = peak_meter_scale_value(val, length); 171 end = peak_meter_scale_value(val, length);
171 } 172 }
173 else if (pb->type == SKIN_TOKEN_LIST_SCROLLBAR)
174 {
175 int val, min, max;
176 skinlist_get_scrollbar(&val, &min, &max);
177 end = val - min;
178 length = max - min;
179 }
172#if CONFIG_TUNER 180#if CONFIG_TUNER
173 else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF)) 181 else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
174 { 182 {
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
36void clear_image_pos(struct gui_wps *gwps, struct gui_img *img); 36void clear_image_pos(struct gui_wps *gwps, struct gui_img *img);
37void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage); 37void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage);
38void wps_display_images(struct gui_wps *gwps, struct viewport* vp); 38void wps_display_images(struct gui_wps *gwps, struct viewport* vp);
39
40
41void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
42 struct skin_viewport* skin_viewport, unsigned long refresh_type);
43
39#endif 44#endif
40 45
41/* Evaluate the conditional that is at *token_index and return whether a skip 46/* 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,
483} 483}
484#endif 484#endif
485 485
486
487static int parse_listitemviewport(struct skin_element *element,
488 struct wps_token *token,
489 struct wps_data *wps_data)
490{
491 struct listitem_viewport_cfg *cfg =
492 (struct listitem_viewport_cfg *)skin_buffer_alloc(
493 sizeof(struct listitem_viewport_cfg));
494 if (!cfg)
495 return -1;
496 cfg->data = wps_data;
497 cfg->tile = false;
498 cfg->label = element->params[0].data.text;
499 cfg->width = -1;
500 cfg->height = -1;
501 if (!isdefault(&element->params[1]))
502 cfg->width = element->params[1].data.number;
503 if (!isdefault(&element->params[2]))
504 cfg->height = element->params[2].data.number;
505 if (element->params_count > 3 &&
506 !strcmp(element->params[3].data.text, "tile"))
507 cfg->tile = true;
508 token->value.data = (void*)cfg;
509 return 0;
510}
511
486#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 512#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
487static int parse_viewporttextstyle(struct skin_element *element, 513static int parse_viewporttextstyle(struct skin_element *element,
488 struct wps_token *token, 514 struct wps_token *token,
@@ -877,6 +903,8 @@ static int parse_progressbar_tag(struct skin_element* element,
877 token->type = SKIN_TOKEN_PEAKMETER_LEFTBAR; 903 token->type = SKIN_TOKEN_PEAKMETER_LEFTBAR;
878 else if (token->type == SKIN_TOKEN_PEAKMETER_RIGHT) 904 else if (token->type == SKIN_TOKEN_PEAKMETER_RIGHT)
879 token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR; 905 token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR;
906 else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR)
907 token->type = SKIN_TOKEN_LIST_SCROLLBAR;
880 pb->type = token->type; 908 pb->type = token->type;
881 909
882 return 0; 910 return 0;
@@ -1719,6 +1747,7 @@ static int skin_element_callback(struct skin_element* element, void* data)
1719 case SKIN_TOKEN_PLAYER_PROGRESSBAR: 1747 case SKIN_TOKEN_PLAYER_PROGRESSBAR:
1720 case SKIN_TOKEN_PEAKMETER_LEFT: 1748 case SKIN_TOKEN_PEAKMETER_LEFT:
1721 case SKIN_TOKEN_PEAKMETER_RIGHT: 1749 case SKIN_TOKEN_PEAKMETER_RIGHT:
1750 case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR:
1722#ifdef HAVE_RADIO_RSSI 1751#ifdef HAVE_RADIO_RSSI
1723 case SKIN_TOKEN_TUNER_RSSI: 1752 case SKIN_TOKEN_TUNER_RSSI:
1724#endif 1753#endif
@@ -1809,6 +1838,9 @@ static int skin_element_callback(struct skin_element* element, void* data)
1809 function = parse_skinvar; 1838 function = parse_skinvar;
1810 break; 1839 break;
1811#endif 1840#endif
1841 case SKIN_TOKEN_LIST_ITEM_CFG:
1842 function = parse_listitemviewport;
1843 break;
1812 default: 1844 default:
1813 break; 1845 break;
1814 } 1846 }
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 @@
46#include "playlist.h" 46#include "playlist.h"
47#include "root_menu.h" 47#include "root_menu.h"
48#include "misc.h" 48#include "misc.h"
49#include "list.h"
49 50
50 51
51#define MAX_LINE 1024 52#define MAX_LINE 1024
@@ -142,6 +143,11 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
142 } 143 }
143 } 144 }
144 break; 145 break;
146 case SKIN_TOKEN_LIST_ITEM_CFG:
147 if (do_refresh)
148 skinlist_set_cfg(gwps->display->screen_type,
149 token->value.data);
150 break;
145#ifdef HAVE_LCD_BITMAP 151#ifdef HAVE_LCD_BITMAP
146 case SKIN_TOKEN_UIVIEWPORT_ENABLE: 152 case SKIN_TOKEN_UIVIEWPORT_ENABLE:
147 sb_set_info_vp(gwps->display->screen_type, 153 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,
164#ifdef HAVE_LCD_BITMAP 170#ifdef HAVE_LCD_BITMAP
165 case SKIN_TOKEN_PROGRESSBAR: 171 case SKIN_TOKEN_PROGRESSBAR:
166 case SKIN_TOKEN_TUNER_RSSI_BAR: 172 case SKIN_TOKEN_TUNER_RSSI_BAR:
173 case SKIN_TOKEN_LIST_SCROLLBAR:
167 { 174 {
168 struct progressbar *bar = (struct progressbar*)token->value.data; 175 struct progressbar *bar = (struct progressbar*)token->value.data;
169 if (do_refresh) 176 if (do_refresh)
@@ -488,10 +495,10 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
488 if (!do_non_text_tags(info->gwps, info, child, &info->skin_vp->vp)) 495 if (!do_non_text_tags(info->gwps, info, child, &info->skin_vp->vp))
489 { 496 {
490 static char tempbuf[128]; 497 static char tempbuf[128];
491 const char *value = get_token_value(info->gwps, child->data, 498 const char *valuestr = get_token_value(info->gwps, child->data,
492 info->offset, tempbuf, 499 info->offset, tempbuf,
493 sizeof(tempbuf), NULL); 500 sizeof(tempbuf), NULL);
494 if (value) 501 if (valuestr)
495 { 502 {
496#if CONFIG_RTC 503#if CONFIG_RTC
497 if (child->tag->flags&SKIN_RTC_REFRESH) 504 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
499#endif 506#endif
500 needs_update = needs_update || 507 needs_update = needs_update ||
501 ((child->tag->flags&info->refresh_type)!=0); 508 ((child->tag->flags&info->refresh_type)!=0);
502 strlcat(info->cur_align_start, value, 509 strlcat(info->cur_align_start, valuestr,
503 info->buf_size - (info->cur_align_start-info->buf)); 510 info->buf_size - (info->cur_align_start-info->buf));
504 } 511 }
505 } 512 }
@@ -612,8 +619,8 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
612 return changed_lines || ret; 619 return changed_lines || ret;
613} 620}
614 621
615static void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps, 622void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
616 struct skin_viewport* skin_viewport, unsigned long refresh_type) 623 struct skin_viewport* skin_viewport, unsigned long refresh_type)
617{ 624{
618 struct screen *display = gwps->display; 625 struct screen *display = gwps->display;
619 char linebuf[MAX_LINE]; 626 char linebuf[MAX_LINE];
@@ -784,10 +791,11 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
784} 791}
785 792
786#ifdef HAVE_LCD_BITMAP 793#ifdef HAVE_LCD_BITMAP
787static __attribute__((noinline)) void skin_render_playlistviewer(struct playlistviewer* viewer, 794static __attribute__((noinline))
788 struct gui_wps *gwps, 795void skin_render_playlistviewer(struct playlistviewer* viewer,
789 struct skin_viewport* skin_viewport, 796 struct gui_wps *gwps,
790 unsigned long refresh_type) 797 struct skin_viewport* skin_viewport,
798 unsigned long refresh_type)
791{ 799{
792 struct screen *display = gwps->display; 800 struct screen *display = gwps->display;
793 char linebuf[MAX_LINE]; 801 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 @@
71#include "radio.h" 71#include "radio.h"
72#include "tuner.h" 72#include "tuner.h"
73#endif 73#endif
74#include "list.h"
74 75
75#define NOINLINE __attribute__ ((noinline)) 76#define NOINLINE __attribute__ ((noinline))
76 77
@@ -894,6 +895,17 @@ const char *get_token_value(struct gui_wps *gwps,
894 *intval = sb_get_icon(gwps->display->screen_type); 895 *intval = sb_get_icon(gwps->display->screen_type);
895 snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type)); 896 snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type));
896 return buf; 897 return buf;
898 case SKIN_TOKEN_LIST_ITEM_TEXT:
899 return skinlist_get_item_text();
900 case SKIN_TOKEN_LIST_ITEM_IS_SELECTED:
901 return skinlist_is_selected_item()?"s":"";
902 case SKIN_TOKEN_LIST_ITEM_ICON:
903 if (intval)
904 *intval = skinlist_get_item_icon();
905 snprintf(buf, buf_size, "%d",skinlist_get_item_icon());
906 return buf;
907 case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR:
908 return skinlist_needs_scrollbar(gwps->display->screen_type) ? "s" : "";
897#endif 909#endif
898 case SKIN_TOKEN_PLAYLIST_NAME: 910 case SKIN_TOKEN_PLAYLIST_NAME:
899 return playlist_name(NULL, buf, buf_size); 911 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 {
193 struct viewport *vp; 193 struct viewport *vp;
194 unsigned colour; 194 unsigned colour;
195}; 195};
196
196#ifdef HAVE_TOUCHSCREEN 197#ifdef HAVE_TOUCHSCREEN
197struct touchregion { 198struct touchregion {
198 char* label; /* label to identify this region */ 199 char* label; /* label to identify this region */