diff options
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 53e1efedd8..b7bb045411 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -453,6 +453,77 @@ static int parse_playlistview(struct skin_element *element, | |||
453 | return 0; | 453 | return 0; |
454 | } | 454 | } |
455 | #endif | 455 | #endif |
456 | #ifdef HAVE_LCD_COLOR | ||
457 | static int parse_viewport_gradient_setup(struct skin_element *element, | ||
458 | struct wps_token *token, | ||
459 | struct wps_data *wps_data) | ||
460 | { | ||
461 | (void)wps_data; | ||
462 | struct gradient_config *cfg; | ||
463 | if (element->params_count < 2) /* only start and end are required */ | ||
464 | return 1; | ||
465 | cfg = (struct gradient_config *)skin_buffer_alloc(sizeof(struct gradient_config)); | ||
466 | if (!cfg) | ||
467 | return 1; | ||
468 | if (!parse_color(curr_screen, element->params[0].data.text, &cfg->start) || | ||
469 | !parse_color(curr_screen, element->params[1].data.text, &cfg->end)) | ||
470 | return 1; | ||
471 | if (element->params_count > 2) | ||
472 | { | ||
473 | if (!parse_color(curr_screen, element->params[2].data.text, &cfg->text)) | ||
474 | return 1; | ||
475 | } | ||
476 | else | ||
477 | { | ||
478 | cfg->text = curr_vp->vp.fg_pattern; | ||
479 | } | ||
480 | |||
481 | token->value.data = cfg; | ||
482 | return 0; | ||
483 | } | ||
484 | #endif | ||
485 | static int parse_viewporttextstyle(struct skin_element *element, | ||
486 | struct wps_token *token, | ||
487 | struct wps_data *wps_data) | ||
488 | { | ||
489 | (void)wps_data; | ||
490 | int style; | ||
491 | char *mode = element->params[0].data.text; | ||
492 | unsigned colour; | ||
493 | |||
494 | if (!strcmp(mode, "invert")) | ||
495 | { | ||
496 | style = STYLE_INVERT; | ||
497 | } | ||
498 | else if (!strcmp(mode, "colour") || !strcmp(mode, "color")) | ||
499 | { | ||
500 | if (element->params_count < 2 || | ||
501 | !parse_color(curr_screen, element->params[1].data.text, &colour)) | ||
502 | return 1; | ||
503 | style = STYLE_COLORED|(STYLE_COLOR_MASK&colour); | ||
504 | } | ||
505 | #ifdef HAVE_LCD_COLOR | ||
506 | else if (!strcmp(mode, "gradient")) | ||
507 | { | ||
508 | int num_lines; | ||
509 | if (element->params_count < 2) | ||
510 | num_lines = 1; | ||
511 | else /* atoi() instead of using a number in the parser is because [si] | ||
512 | * will select the number for something which looks like a colour | ||
513 | * making the "colour" case (above) harder to parse */ | ||
514 | num_lines = atoi(element->params[1].data.text); | ||
515 | style = STYLE_GRADIENT|NUMLN_PACK(num_lines)|CURLN_PACK(0); | ||
516 | } | ||
517 | #endif | ||
518 | else if (!strcmp(mode, "clear")) | ||
519 | { | ||
520 | style = STYLE_DEFAULT; | ||
521 | } | ||
522 | else | ||
523 | return 1; | ||
524 | token->value.l = style; | ||
525 | return 0; | ||
526 | } | ||
456 | 527 | ||
457 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 528 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
458 | 529 | ||
@@ -1514,6 +1585,11 @@ static int convert_viewport(struct wps_data *data, struct skin_element* element) | |||
1514 | skin_vp->start_fgcolour = skin_vp->vp.fg_pattern; | 1585 | skin_vp->start_fgcolour = skin_vp->vp.fg_pattern; |
1515 | skin_vp->start_bgcolour = skin_vp->vp.bg_pattern; | 1586 | skin_vp->start_bgcolour = skin_vp->vp.bg_pattern; |
1516 | #endif | 1587 | #endif |
1588 | #ifdef HAVE_LCD_COLOR | ||
1589 | skin_vp->start_gradient.start = skin_vp->vp.lss_pattern; | ||
1590 | skin_vp->start_gradient.end = skin_vp->vp.lse_pattern; | ||
1591 | skin_vp->start_gradient.text = skin_vp->vp.lst_pattern; | ||
1592 | #endif | ||
1517 | 1593 | ||
1518 | 1594 | ||
1519 | struct skin_tag_parameter *param = element->params; | 1595 | struct skin_tag_parameter *param = element->params; |
@@ -1684,6 +1760,14 @@ static int skin_element_callback(struct skin_element* element, void* data) | |||
1684 | function = parse_image_special; | 1760 | function = parse_image_special; |
1685 | break; | 1761 | break; |
1686 | #endif | 1762 | #endif |
1763 | case SKIN_TOKEN_VIEWPORT_TEXTSTYLE: | ||
1764 | function = parse_viewporttextstyle; | ||
1765 | break; | ||
1766 | #ifdef HAVE_LCD_COLOR | ||
1767 | case SKIN_TOKEN_VIEWPORT_GRADIENT_SETUP: | ||
1768 | function = parse_viewport_gradient_setup; | ||
1769 | break; | ||
1770 | #endif | ||
1687 | case SKIN_TOKEN_TRANSLATEDSTRING: | 1771 | case SKIN_TOKEN_TRANSLATEDSTRING: |
1688 | case SKIN_TOKEN_SETTING: | 1772 | case SKIN_TOKEN_SETTING: |
1689 | function = parse_setting_and_lang; | 1773 | function = parse_setting_and_lang; |