2005-11-17 20:20:01 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2007-04-04 14:41:40 +00:00
|
|
|
* Copyright (C) 2007 Nicolas Pennequin
|
2005-11-17 20:20:01 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-11-17 20:20:01 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
/* This stuff is for the wps engine only.. anyone caught using this outside
|
|
|
|
* of apps/gui/wps_engine will be shot on site! */
|
|
|
|
|
|
|
|
#ifndef _WPS_ENGINE_INTERNALS_
|
|
|
|
#define _WPS_ENGINE_INTERNALS_
|
2010-07-29 12:37:48 +00:00
|
|
|
|
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
/* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds
|
|
|
|
(possibly with a decimal fraction) but stored as integer values.
|
|
|
|
E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units.
|
|
|
|
*/
|
|
|
|
#define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */
|
|
|
|
#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */
|
|
|
|
|
2009-08-16 18:23:00 +00:00
|
|
|
#include "skin_tokens.h"
|
2010-07-29 12:37:48 +00:00
|
|
|
#include "tag_table.h"
|
|
|
|
#include "skin_parser.h"
|
2009-07-27 07:21:05 +00:00
|
|
|
|
2010-03-06 14:14:44 +00:00
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
/* TODO: sort this mess out */
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
#include "screen_access.h"
|
2005-11-20 22:13:52 +00:00
|
|
|
#include "statusbar.h"
|
2008-10-15 06:38:51 +00:00
|
|
|
#include "metadata.h"
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
/* alignments */
|
|
|
|
#define WPS_ALIGN_RIGHT 32
|
|
|
|
#define WPS_ALIGN_CENTER 64
|
|
|
|
#define WPS_ALIGN_LEFT 128
|
|
|
|
|
2010-08-05 11:28:48 +00:00
|
|
|
|
New skin tag: %if(<tag>, <operator>, <operand> [,option count]) which lets you do very simple logical comparissons on other tags.
<tag> is the tag to check against
<operator> is the comparisson to do, any one of... =, !=, >, >=, <, <= (when comparring against a string tag like %ia only = and != work, and it is done NOT case sensitive)
<operand> is either another tag, a number, or text.
[option count] is an optinal number to use for the few tags which scale to the amount of options when used as a conditional (i.e %?pv<a|b|c|d> would have 4 options)
example: %?if(%pv, >=, 0)<Warning.. volume clipping|coool...>
That says "If the value from %pv (volume) is greater than or equal to 0 then display the warning line, otherwise the cool line."
%?if(%ia, =, %Ia)<same artist> <= this artist and next artist are the same.
some tags might need a touch of tweaking to work better with this. experiment and have fun
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27846 a1c6a512-1295-4272-9138-f99709370657
2010-08-19 13:49:32 +00:00
|
|
|
#define TOKEN_VALUE_ONLY 0x0DEADC0D
|
2010-08-05 11:28:48 +00:00
|
|
|
|
2007-11-11 12:29:37 +00:00
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
|
|
|
|
/* albumart definitions */
|
|
|
|
#define WPS_ALBUMART_NONE 0 /* WPS does not contain AA tag */
|
|
|
|
#define WPS_ALBUMART_CHECK 1 /* WPS contains AA conditional tag */
|
|
|
|
#define WPS_ALBUMART_LOAD 2 /* WPS contains AA tag */
|
|
|
|
|
2008-12-09 23:07:59 +00:00
|
|
|
#define WPS_ALBUMART_ALIGN_RIGHT 1 /* x align: right */
|
|
|
|
#define WPS_ALBUMART_ALIGN_CENTER 2 /* x/y align: center */
|
|
|
|
#define WPS_ALBUMART_ALIGN_LEFT 4 /* x align: left */
|
|
|
|
#define WPS_ALBUMART_ALIGN_TOP 1 /* y align: top */
|
|
|
|
#define WPS_ALBUMART_ALIGN_BOTTOM 4 /* y align: bottom */
|
2007-11-11 12:29:37 +00:00
|
|
|
|
|
|
|
#endif /* HAVE_ALBUMART */
|
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
/* wps_data*/
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2009-03-08 11:32:02 +00:00
|
|
|
struct gui_img {
|
2008-03-21 19:38:00 +00:00
|
|
|
struct viewport* vp; /* The viewport to display this image in */
|
2008-04-27 12:54:36 +00:00
|
|
|
short int x; /* x-pos */
|
|
|
|
short int y; /* y-pos */
|
|
|
|
short int num_subimages; /* number of sub-images */
|
|
|
|
short int subimage_height; /* height of each sub-image */
|
2009-10-19 00:26:46 +00:00
|
|
|
struct bitmap bm;
|
2011-09-08 12:38:21 +00:00
|
|
|
int buflib_handle;
|
2010-08-14 11:40:20 +00:00
|
|
|
const char *label;
|
2005-11-17 20:20:01 +00:00
|
|
|
bool loaded; /* load state */
|
|
|
|
bool always_display; /* not using the preload/display mechanism */
|
2010-07-29 12:37:48 +00:00
|
|
|
int display;
|
2010-08-12 13:27:10 +00:00
|
|
|
bool using_preloaded_icons; /* using the icon system instead of a bmp */
|
2005-11-17 20:20:01 +00:00
|
|
|
};
|
2006-02-10 13:57:11 +00:00
|
|
|
|
2010-08-05 11:28:48 +00:00
|
|
|
struct image_display {
|
2010-08-14 11:40:20 +00:00
|
|
|
const char *label;
|
2010-08-05 11:28:48 +00:00
|
|
|
int subimage;
|
|
|
|
struct wps_token *token; /* the token to get the subimage number from */
|
|
|
|
int offset; /* offset into the bitmap strip to start */
|
|
|
|
};
|
2009-08-16 18:23:00 +00:00
|
|
|
|
2008-06-23 06:04:17 +00:00
|
|
|
struct progressbar {
|
2010-07-29 12:37:48 +00:00
|
|
|
enum skin_token_type type;
|
2010-04-11 11:18:45 +00:00
|
|
|
struct viewport *vp;
|
2008-06-23 06:04:17 +00:00
|
|
|
/* regular pb */
|
|
|
|
short x;
|
2009-03-08 11:32:02 +00:00
|
|
|
/* >=0: explicitly set in the tag -> y-coord within the viewport
|
|
|
|
<0 : not set in the tag -> negated 1-based line number within
|
|
|
|
the viewport. y-coord will be computed based on the font height */
|
2008-06-23 06:04:17 +00:00
|
|
|
short y;
|
|
|
|
short width;
|
|
|
|
short height;
|
2010-01-07 07:34:15 +00:00
|
|
|
bool follow_lang_direction;
|
skin bar tag: Load an image from a label or filename. i.e %xl(bar_image, pb.bmp,0,0) %pb(0,0,10,10,bar_image) or %pb(0,0,10,10, pb.bmp) both are acceptable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28249 a1c6a512-1295-4272-9138-f99709370657
2010-10-12 12:46:57 +00:00
|
|
|
|
|
|
|
struct gui_img *image;
|
A bunch of new features for the bar type tags (%pb, %pv, %bl, etc):
* the bar orientation (horiz/vert) is now chosen based on the width and heigt values (or can be forced).
* the fill direction can now be inverted (fill right to left, or top to bottom is considered inverted)
* It can now draw a slider type bar instead of a fill type (or indeed a slider with a fill type)
To configure the new bar, any (or all) of the following params can be used after the bmp filename (order makes no difference either):
invert - cause the bar to fill in the inverted direction
vertical - draw a vertical bar (not needed if the height > width)
horizontal - draw a horizontal bar (this is obviously the default)
nofill - dont draw the filling bar (this still draws the outline, obviously pointless without the slider param)
slider - draw an image for the slider. The next param MUST be the label of the image to draw. No option to use a subimage here, so the whole image needs to be the image you want on the slider.
example: %pb(0,0,-,-,-,nofill, slider, slider_image, invert) - draw a boring horizontal progressbar which doesnt fill and only draws the image "slider_image" which moves right to left.
the slider type might need some tweaking. let us know how it goes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27821 a1c6a512-1295-4272-9138-f99709370657
2010-08-15 14:13:36 +00:00
|
|
|
|
|
|
|
bool invert_fill_direction;
|
|
|
|
bool nofill;
|
2010-10-12 12:17:39 +00:00
|
|
|
bool nobar;
|
A bunch of new features for the bar type tags (%pb, %pv, %bl, etc):
* the bar orientation (horiz/vert) is now chosen based on the width and heigt values (or can be forced).
* the fill direction can now be inverted (fill right to left, or top to bottom is considered inverted)
* It can now draw a slider type bar instead of a fill type (or indeed a slider with a fill type)
To configure the new bar, any (or all) of the following params can be used after the bmp filename (order makes no difference either):
invert - cause the bar to fill in the inverted direction
vertical - draw a vertical bar (not needed if the height > width)
horizontal - draw a horizontal bar (this is obviously the default)
nofill - dont draw the filling bar (this still draws the outline, obviously pointless without the slider param)
slider - draw an image for the slider. The next param MUST be the label of the image to draw. No option to use a subimage here, so the whole image needs to be the image you want on the slider.
example: %pb(0,0,-,-,-,nofill, slider, slider_image, invert) - draw a boring horizontal progressbar which doesnt fill and only draws the image "slider_image" which moves right to left.
the slider type might need some tweaking. let us know how it goes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27821 a1c6a512-1295-4272-9138-f99709370657
2010-08-15 14:13:36 +00:00
|
|
|
struct gui_img *slider;
|
|
|
|
bool horizontal;
|
New option for the bar tags: 'backdrop, <label>' will draw another image under the progressbar (only works with image and slider bars)
example:
%V(22,253,198,14,-)
%xl(a,PLAY_BAR_BACKDROP-240x320x16.bmp,0,0)
%pb(0,0,198,14,PLAY_BAR-240x320x16.bmp, backdrop, a)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29127 a1c6a512-1295-4272-9138-f99709370657
2011-01-24 09:04:28 +00:00
|
|
|
struct gui_img *backdrop;
|
2006-02-10 13:57:11 +00:00
|
|
|
};
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-20 01:41:56 +00:00
|
|
|
|
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
struct align_pos {
|
|
|
|
char* left;
|
|
|
|
char* center;
|
|
|
|
char* right;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
#define MAX_IMAGES (26*2) /* a-z and A-Z */
|
2008-06-23 06:04:17 +00:00
|
|
|
#define MAX_PROGRESSBARS 3
|
2008-04-04 12:32:37 +00:00
|
|
|
|
|
|
|
/* The image buffer is big enough to store one full-screen native bitmap,
|
|
|
|
plus two full-screen mono bitmaps. */
|
|
|
|
|
2008-06-23 06:04:17 +00:00
|
|
|
#define WPS_MAX_VIEWPORTS 24
|
2008-03-22 00:31:22 +00:00
|
|
|
#define WPS_MAX_LINES ((LCD_HEIGHT/5+1) * 2)
|
2007-04-08 04:01:06 +00:00
|
|
|
#define WPS_MAX_SUBLINES (WPS_MAX_LINES*3)
|
2011-10-16 15:55:12 +00:00
|
|
|
#define WPS_MAX_TOKENS 1150
|
2007-04-08 04:01:06 +00:00
|
|
|
#define WPS_MAX_STRINGS 128
|
2007-04-15 02:59:34 +00:00
|
|
|
#define STRING_BUFFER_SIZE 1024
|
2007-04-08 04:01:06 +00:00
|
|
|
#define WPS_MAX_COND_LEVEL 10
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
#else
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2008-03-21 19:38:00 +00:00
|
|
|
#define WPS_MAX_VIEWPORTS 2
|
2007-04-08 04:01:06 +00:00
|
|
|
#define WPS_MAX_LINES 2
|
|
|
|
#define WPS_MAX_SUBLINES 12
|
|
|
|
#define WPS_MAX_TOKENS 64
|
|
|
|
#define WPS_MAX_STRINGS 32
|
|
|
|
#define STRING_BUFFER_SIZE 64
|
|
|
|
#define WPS_MAX_COND_LEVEL 5
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
#define SUBLINE_RESET -1
|
|
|
|
|
2008-07-12 15:12:09 +00:00
|
|
|
enum wps_parse_error {
|
|
|
|
PARSE_OK,
|
|
|
|
PARSE_FAIL_UNCLOSED_COND,
|
|
|
|
PARSE_FAIL_INVALID_CHAR,
|
|
|
|
PARSE_FAIL_COND_SYNTAX_ERROR,
|
|
|
|
PARSE_FAIL_COND_INVALID_PARAM,
|
|
|
|
PARSE_FAIL_LIMITS_EXCEEDED,
|
|
|
|
};
|
2011-08-14 13:50:07 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
struct gradient_config {
|
|
|
|
unsigned start;
|
|
|
|
unsigned end;
|
|
|
|
unsigned text;
|
|
|
|
int lines_count;
|
|
|
|
};
|
|
|
|
#endif
|
2008-07-12 15:12:09 +00:00
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
#define VP_DRAW_HIDEABLE 0x1
|
|
|
|
#define VP_DRAW_HIDDEN 0x2
|
|
|
|
#define VP_DRAW_WASHIDDEN 0x4
|
|
|
|
/* these are never drawn, nor cleared, i.e. just ignored */
|
|
|
|
#define VP_NEVER_VISIBLE 0x8
|
2010-08-02 12:50:23 +00:00
|
|
|
#define VP_DEFAULT_LABEL "|"
|
2009-08-18 05:30:59 +00:00
|
|
|
struct skin_viewport {
|
2008-03-21 19:38:00 +00:00
|
|
|
struct viewport vp; /* The LCD viewport struct */
|
2008-06-23 06:04:17 +00:00
|
|
|
char hidden_flags;
|
2010-08-02 12:50:23 +00:00
|
|
|
bool is_infovp;
|
|
|
|
char* label;
|
2011-09-24 13:19:34 +00:00
|
|
|
int parsed_fontid;
|
2011-08-14 13:50:07 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2010-06-07 03:44:11 +00:00
|
|
|
unsigned start_fgcolour;
|
|
|
|
unsigned start_bgcolour;
|
2011-08-14 13:50:07 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
struct gradient_config start_gradient;
|
|
|
|
#endif
|
|
|
|
#endif
|
2010-06-07 03:44:11 +00:00
|
|
|
};
|
|
|
|
struct viewport_colour {
|
|
|
|
struct viewport *vp;
|
|
|
|
unsigned colour;
|
2008-03-21 19:38:00 +00:00
|
|
|
};
|
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though.
The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves).
Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern.
The UI viewport is used to bound the items (i.e %Vi() )
Scrolling is completly disabled in all items except the currently selected item.
This works well in combination with the %cs tag to show differently styled lists based on the current screen :)
New tags:
%LT - Get the current items text
%LI - Get the current items icon number
%Lc - Use as a conditional to determine if the current item is the selected item
%LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed
%Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list
example.sbs:
%?cs<%Lb(a,100,20)|>
%V(0,0,10,-,1)%Vf(aabbcc)
%?LB<%LB(0,0,10,185, invert)>
%Vi(-,10,0,-,-35,1)
%Vl(a,5,5,160,12,1)
%s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<>
%V(0,185,-,-,1)
%s%LT
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
2011-09-06 13:49:41 +00:00
|
|
|
|
2009-04-20 01:41:56 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
struct touchregion {
|
2011-02-28 11:19:59 +00:00
|
|
|
char* label; /* label to identify this region */
|
2009-08-18 05:30:59 +00:00
|
|
|
struct skin_viewport* wvp;/* The viewport this region is in */
|
2009-04-20 01:41:56 +00:00
|
|
|
short int x; /* x-pos */
|
|
|
|
short int y; /* y-pos */
|
|
|
|
short int width; /* width */
|
|
|
|
short int height; /* height */
|
2010-06-21 12:43:08 +00:00
|
|
|
bool reverse_bar; /* if true 0% is the left or top */
|
2011-07-28 11:26:01 +00:00
|
|
|
bool allow_while_locked;
|
2011-03-27 07:23:38 +00:00
|
|
|
enum {
|
|
|
|
PRESS, /* quick press only */
|
|
|
|
LONG_PRESS, /* Long press without repeat */
|
|
|
|
REPEAT, /* long press allowing repeats */
|
|
|
|
} press_length;
|
2009-04-20 01:41:56 +00:00
|
|
|
int action; /* action this button will return */
|
2010-02-24 06:19:25 +00:00
|
|
|
bool armed; /* A region is armed on press. Only armed regions are triggered
|
|
|
|
on repeat or release. */
|
2011-01-13 10:56:23 +00:00
|
|
|
union { /* Extra data, action dependant */
|
2011-03-01 12:31:03 +00:00
|
|
|
struct touchsetting {
|
2011-03-27 08:01:58 +00:00
|
|
|
const struct settings_list *setting; /* setting being controlled */
|
|
|
|
union { /* Value to set the setting to for ACTION_SETTING_SET */
|
|
|
|
int number;
|
|
|
|
char* text;
|
|
|
|
} value;
|
|
|
|
} setting_data;
|
2011-01-13 10:56:23 +00:00
|
|
|
int value;
|
|
|
|
};
|
2011-02-28 11:19:59 +00:00
|
|
|
long last_press; /* last tick this was pressed */
|
|
|
|
};
|
|
|
|
|
2011-03-01 12:31:03 +00:00
|
|
|
|
|
|
|
|
2011-02-28 11:19:59 +00:00
|
|
|
struct touchregion_lastpress {
|
|
|
|
struct touchregion *region;
|
|
|
|
long timeout;
|
2009-04-20 01:41:56 +00:00
|
|
|
};
|
|
|
|
#endif
|
2009-09-07 02:36:56 +00:00
|
|
|
|
2010-01-13 06:02:38 +00:00
|
|
|
struct playlistviewer {
|
|
|
|
struct viewport *vp;
|
|
|
|
bool show_icons;
|
|
|
|
int start_offset;
|
2010-08-14 15:17:59 +00:00
|
|
|
struct skin_element *line;
|
2010-01-13 06:02:38 +00:00
|
|
|
};
|
|
|
|
|
2009-09-07 02:36:56 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
struct skin_albumart {
|
|
|
|
/* Album art support */
|
2009-09-25 18:36:28 +00:00
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
2009-09-07 02:36:56 +00:00
|
|
|
|
2009-09-25 18:36:28 +00:00
|
|
|
unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
|
|
|
|
unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
|
|
|
|
unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
|
2010-07-29 12:37:48 +00:00
|
|
|
|
|
|
|
struct viewport *vp;
|
|
|
|
int draw_handle;
|
2009-09-07 02:36:56 +00:00
|
|
|
};
|
|
|
|
#endif
|
New skin tag: %if(<tag>, <operator>, <operand> [,option count]) which lets you do very simple logical comparissons on other tags.
<tag> is the tag to check against
<operator> is the comparisson to do, any one of... =, !=, >, >=, <, <= (when comparring against a string tag like %ia only = and != work, and it is done NOT case sensitive)
<operand> is either another tag, a number, or text.
[option count] is an optinal number to use for the few tags which scale to the amount of options when used as a conditional (i.e %?pv<a|b|c|d> would have 4 options)
example: %?if(%pv, >=, 0)<Warning.. volume clipping|coool...>
That says "If the value from %pv (volume) is greater than or equal to 0 then display the warning line, otherwise the cool line."
%?if(%ia, =, %Ia)<same artist> <= this artist and next artist are the same.
some tags might need a touch of tweaking to work better with this. experiment and have fun
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27846 a1c6a512-1295-4272-9138-f99709370657
2010-08-19 13:49:32 +00:00
|
|
|
|
2010-07-29 12:37:48 +00:00
|
|
|
|
|
|
|
struct line {
|
|
|
|
unsigned update_mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct line_alternator {
|
|
|
|
int current_line;
|
2010-10-10 06:47:52 +00:00
|
|
|
unsigned long next_change_tick;
|
2010-07-29 12:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct conditional {
|
|
|
|
int last_value;
|
|
|
|
struct wps_token *token;
|
|
|
|
};
|
|
|
|
|
New skin tag: %if(<tag>, <operator>, <operand> [,option count]) which lets you do very simple logical comparissons on other tags.
<tag> is the tag to check against
<operator> is the comparisson to do, any one of... =, !=, >, >=, <, <= (when comparring against a string tag like %ia only = and != work, and it is done NOT case sensitive)
<operand> is either another tag, a number, or text.
[option count] is an optinal number to use for the few tags which scale to the amount of options when used as a conditional (i.e %?pv<a|b|c|d> would have 4 options)
example: %?if(%pv, >=, 0)<Warning.. volume clipping|coool...>
That says "If the value from %pv (volume) is greater than or equal to 0 then display the warning line, otherwise the cool line."
%?if(%ia, =, %Ia)<same artist> <= this artist and next artist are the same.
some tags might need a touch of tweaking to work better with this. experiment and have fun
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27846 a1c6a512-1295-4272-9138-f99709370657
2010-08-19 13:49:32 +00:00
|
|
|
struct logical_if {
|
|
|
|
struct wps_token *token;
|
|
|
|
enum {
|
|
|
|
IF_EQUALS, /* == */
|
|
|
|
IF_NOTEQUALS, /* != */
|
|
|
|
IF_LESSTHAN, /* < */
|
|
|
|
IF_LESSTHAN_EQ, /* <= */
|
|
|
|
IF_GREATERTHAN, /* > */
|
|
|
|
IF_GREATERTHAN_EQ /* >= */
|
|
|
|
} op;
|
|
|
|
struct skin_tag_parameter operand;
|
|
|
|
int num_options;
|
|
|
|
};
|
2010-07-29 12:37:48 +00:00
|
|
|
|
2011-09-11 01:50:06 +00:00
|
|
|
struct substring {
|
|
|
|
int start;
|
|
|
|
int length;
|
|
|
|
struct wps_token *token;
|
|
|
|
};
|
|
|
|
|
2011-09-11 10:44:17 +00:00
|
|
|
struct listitem {
|
|
|
|
bool wrap;
|
|
|
|
short offset;
|
|
|
|
};
|
|
|
|
|
2011-03-27 08:01:58 +00:00
|
|
|
#ifdef HAVE_SKIN_VARIABLES
|
|
|
|
struct skin_var {
|
|
|
|
const char *label;
|
|
|
|
int value;
|
|
|
|
long last_changed;
|
|
|
|
};
|
|
|
|
struct skin_var_lastchange {
|
|
|
|
struct skin_var *var;
|
|
|
|
long timeout;
|
|
|
|
};
|
|
|
|
struct skin_var_changer {
|
|
|
|
struct skin_var *var;
|
|
|
|
int newval;
|
|
|
|
bool direct; /* true to make val=newval, false for val += newval */
|
|
|
|
int max;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
/* wps_data
|
2007-04-04 14:41:40 +00:00
|
|
|
this struct holds all necessary data which describes the
|
2005-11-17 20:20:01 +00:00
|
|
|
viewable content of a wps */
|
|
|
|
struct wps_data
|
|
|
|
{
|
2010-07-29 12:37:48 +00:00
|
|
|
struct skin_element *tree;
|
2005-11-17 20:20:01 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2009-08-16 18:23:00 +00:00
|
|
|
struct skin_token_list *images;
|
2011-09-24 13:19:34 +00:00
|
|
|
int *font_ids;
|
|
|
|
int font_count;
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
2010-01-29 07:52:13 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
2010-09-14 11:56:50 +00:00
|
|
|
struct {
|
|
|
|
char *backdrop;
|
|
|
|
int backdrop_id;
|
|
|
|
};
|
2010-01-29 07:52:13 +00:00
|
|
|
#endif
|
2007-04-25 13:09:56 +00:00
|
|
|
|
2009-04-20 01:41:56 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2009-08-16 21:22:57 +00:00
|
|
|
struct skin_token_list *touchregions;
|
2011-07-28 11:26:01 +00:00
|
|
|
bool touchscreen_locked;
|
2009-04-20 01:41:56 +00:00
|
|
|
#endif
|
2009-10-14 15:49:11 +00:00
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
struct skin_albumart *albumart;
|
2009-10-16 19:14:41 +00:00
|
|
|
int playback_aa_slot;
|
2009-10-14 15:49:11 +00:00
|
|
|
#endif
|
2009-10-16 20:34:04 +00:00
|
|
|
|
2011-03-27 08:01:58 +00:00
|
|
|
#ifdef HAVE_SKIN_VARIABLES
|
|
|
|
struct skin_token_list *skinvars;
|
|
|
|
#endif
|
|
|
|
|
2009-10-14 15:49:11 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
bool peak_meter_enabled;
|
|
|
|
bool wps_sb_tag;
|
|
|
|
bool show_sb_on_wps;
|
|
|
|
#else /*HAVE_LCD_CHARCELLS */
|
|
|
|
unsigned short wps_progress_pat[8];
|
|
|
|
bool full_line_progressbar;
|
|
|
|
#endif
|
|
|
|
bool wps_loaded;
|
2005-11-17 20:20:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* wps_data end */
|
|
|
|
|
|
|
|
/* wps_state
|
|
|
|
holds the data which belongs to the current played track,
|
|
|
|
the track which will be played afterwards, current path to the track
|
|
|
|
and some status infos */
|
|
|
|
struct wps_state
|
|
|
|
{
|
2009-11-01 13:36:52 +00:00
|
|
|
struct mp3entry* id3;
|
|
|
|
struct mp3entry* nid3;
|
|
|
|
int ff_rewind_count;
|
2005-11-17 20:20:01 +00:00
|
|
|
bool ff_rewind;
|
|
|
|
bool paused;
|
2009-11-01 13:36:52 +00:00
|
|
|
bool is_fading;
|
2005-11-17 20:20:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* change the ff/rew-status
|
2006-04-02 10:41:16 +00:00
|
|
|
if ff_rew = true then we are in skipping mode
|
2005-11-17 20:20:01 +00:00
|
|
|
else we are in normal mode */
|
2006-12-13 11:52:21 +00:00
|
|
|
/* void wps_state_update_ff_rew(bool ff_rew); Currently unused */
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
/* change the tag-information of the current played track
|
|
|
|
and the following track */
|
2006-12-13 11:52:21 +00:00
|
|
|
/* void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3); Currently unused */
|
2005-11-17 20:20:01 +00:00
|
|
|
/* wps_state end*/
|
|
|
|
|
|
|
|
/* gui_wps
|
2007-04-08 04:01:06 +00:00
|
|
|
defines a wps with its data, state,
|
2005-11-17 20:20:01 +00:00
|
|
|
and the screen on which the wps-content should be drawn */
|
|
|
|
struct gui_wps
|
|
|
|
{
|
2007-04-08 04:01:06 +00:00
|
|
|
struct screen *display;
|
2005-11-17 20:20:01 +00:00
|
|
|
struct wps_data *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* gui_wps end */
|
|
|
|
|
2010-02-16 05:24:27 +00:00
|
|
|
char *get_image_filename(const char *start, const char* bmpdir,
|
|
|
|
char *buf, int buf_size);
|
2009-07-27 07:21:05 +00:00
|
|
|
/***** wps_tokens.c ******/
|
2005-11-17 20:20:01 +00:00
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
const char *get_token_value(struct gui_wps *gwps,
|
2010-08-14 15:17:59 +00:00
|
|
|
struct wps_token *token, int offset,
|
2009-07-27 07:21:05 +00:00
|
|
|
char *buf, int buf_size,
|
|
|
|
int *intval);
|
2007-11-11 12:29:37 +00:00
|
|
|
|
2010-07-29 13:23:33 +00:00
|
|
|
/* Get the id3 fields from the cuesheet */
|
|
|
|
const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3,
|
|
|
|
int offset_tracks, char *buf, int buf_size);
|
2010-01-15 07:20:56 +00:00
|
|
|
const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
2010-08-14 15:17:59 +00:00
|
|
|
char *filename, char *buf, int buf_size, int limit, int *intval);
|
2010-05-12 10:38:00 +00:00
|
|
|
#if CONFIG_TUNER
|
|
|
|
const char *get_radio_token(struct wps_token *token, int preset_offset,
|
|
|
|
char *buf, int buf_size, int limit, int *intval);
|
|
|
|
#endif
|
2009-08-16 18:23:00 +00:00
|
|
|
|
2011-03-07 12:45:45 +00:00
|
|
|
enum skin_find_what {
|
2011-03-27 08:01:58 +00:00
|
|
|
SKIN_FIND_VP = 0,
|
|
|
|
SKIN_FIND_UIVP,
|
2011-03-07 13:09:04 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2011-03-27 08:01:58 +00:00
|
|
|
SKIN_FIND_IMAGE,
|
2011-03-07 13:09:04 +00:00
|
|
|
#endif
|
2011-03-07 12:56:24 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2011-03-27 08:01:58 +00:00
|
|
|
SKIN_FIND_TOUCHREGION,
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SKIN_VARIABLES
|
|
|
|
SKIN_VARIABLE,
|
2011-03-07 12:56:24 +00:00
|
|
|
#endif
|
2011-03-07 12:45:45 +00:00
|
|
|
};
|
|
|
|
void *skin_find_item(const char *label, enum skin_find_what what,
|
2011-03-27 08:01:58 +00:00
|
|
|
struct wps_data *data);
|
2010-07-11 16:46:54 +00:00
|
|
|
#ifdef SIMULATOR
|
2010-03-14 11:32:03 +00:00
|
|
|
#define DEBUG_SKIN_ENGINE
|
|
|
|
extern bool debug_wps;
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|