forked from len0rd/rockbox
move viewports into the skin buffer, no more viewport limit on the skin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22403 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fed07312ed
commit
36ca4967e0
5 changed files with 123 additions and 89 deletions
|
@ -100,8 +100,9 @@ bool gui_wps_display(struct gui_wps *gwps)
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
if (display->depth > 1)
|
if (display->depth > 1)
|
||||||
{
|
{
|
||||||
gwps->data->viewports[0].vp.fg_pattern = display->get_foreground();
|
struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, gwps->data)->vp;
|
||||||
gwps->data->viewports[0].vp.bg_pattern = display->get_background();
|
vp->fg_pattern = display->get_foreground();
|
||||||
|
vp->bg_pattern = display->get_background();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
display->clear_display();
|
display->clear_display();
|
||||||
|
@ -132,7 +133,7 @@ bool skin_update(struct gui_wps *gwps, unsigned int update_type)
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
static void draw_progressbar(struct gui_wps *gwps,
|
static void draw_progressbar(struct gui_wps *gwps,
|
||||||
struct wps_viewport *wps_vp)
|
struct skin_viewport *wps_vp)
|
||||||
{
|
{
|
||||||
struct screen *display = gwps->display;
|
struct screen *display = gwps->display;
|
||||||
struct wps_state *state = gwps->state;
|
struct wps_state *state = gwps->state;
|
||||||
|
@ -490,6 +491,19 @@ struct gui_img* find_image(int n, struct wps_data *data)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct skin_viewport* find_viewport(char label, struct wps_data *data)
|
||||||
|
{
|
||||||
|
struct skin_token_list *list = data->viewports;
|
||||||
|
while (list)
|
||||||
|
{
|
||||||
|
struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data;
|
||||||
|
if (vp->label == label)
|
||||||
|
return vp;
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read a (sub)line to the given alignment format buffer.
|
/* Read a (sub)line to the given alignment format buffer.
|
||||||
|
@ -590,18 +604,13 @@ static bool get_line(struct gui_wps *gwps,
|
||||||
case WPS_VIEWPORT_ENABLE:
|
case WPS_VIEWPORT_ENABLE:
|
||||||
{
|
{
|
||||||
char label = data->tokens[i].value.i;
|
char label = data->tokens[i].value.i;
|
||||||
int j;
|
|
||||||
char temp = VP_DRAW_HIDEABLE;
|
char temp = VP_DRAW_HIDEABLE;
|
||||||
for(j=0;j<data->num_viewports;j++)
|
struct skin_viewport *vp = find_viewport(label, data);
|
||||||
|
if (vp)
|
||||||
{
|
{
|
||||||
temp = VP_DRAW_HIDEABLE;
|
if (vp->hidden_flags&VP_DRAW_WASHIDDEN)
|
||||||
if ((data->viewports[j].hidden_flags&VP_DRAW_HIDEABLE) &&
|
temp |= VP_DRAW_WASHIDDEN;
|
||||||
(data->viewports[j].label == label))
|
vp->hidden_flags = temp;
|
||||||
{
|
|
||||||
if (data->viewports[j].hidden_flags&VP_DRAW_WASHIDDEN)
|
|
||||||
temp |= VP_DRAW_WASHIDDEN;
|
|
||||||
data->viewports[j].hidden_flags = temp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -926,7 +935,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
if (!id3)
|
if (!id3)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int v, line, i, subline_idx;
|
int line, i, subline_idx;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
char linebuf[MAX_PATH];
|
char linebuf[MAX_PATH];
|
||||||
|
|
||||||
|
@ -953,7 +962,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
/* reset to first subline if refresh all flag is set */
|
/* reset to first subline if refresh all flag is set */
|
||||||
if (refresh_mode == WPS_REFRESH_ALL)
|
if (refresh_mode == WPS_REFRESH_ALL)
|
||||||
{
|
{
|
||||||
display->set_viewport(&data->viewports[0].vp);
|
display->set_viewport(&find_viewport(VP_DEFAULT_LABEL, data)->vp);
|
||||||
display->clear_viewport();
|
display->clear_viewport();
|
||||||
|
|
||||||
for (i = 0; i <= data->num_lines; i++)
|
for (i = 0; i <= data->num_lines; i++)
|
||||||
|
@ -971,21 +980,28 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* disable any viewports which are conditionally displayed */
|
/* disable any viewports which are conditionally displayed */
|
||||||
for (v = 0; v < data->num_viewports; v++)
|
struct skin_token_list *viewport_list;
|
||||||
|
for (viewport_list = data->viewports;
|
||||||
|
viewport_list; viewport_list = viewport_list->next)
|
||||||
{
|
{
|
||||||
if (data->viewports[v].hidden_flags&VP_DRAW_HIDEABLE)
|
struct skin_viewport *skin_viewport =
|
||||||
|
(struct skin_viewport *)viewport_list->token->value.data;
|
||||||
|
if (skin_viewport->hidden_flags&VP_DRAW_HIDEABLE)
|
||||||
{
|
{
|
||||||
if (data->viewports[v].hidden_flags&VP_DRAW_HIDDEN)
|
if (skin_viewport->hidden_flags&VP_DRAW_HIDDEN)
|
||||||
data->viewports[v].hidden_flags |= VP_DRAW_WASHIDDEN;
|
skin_viewport->hidden_flags |= VP_DRAW_WASHIDDEN;
|
||||||
else
|
else
|
||||||
data->viewports[v].hidden_flags |= VP_DRAW_HIDDEN;
|
skin_viewport->hidden_flags |= VP_DRAW_HIDDEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (v = 0; v < data->num_viewports; v++)
|
|
||||||
|
for (viewport_list = data->viewports;
|
||||||
|
viewport_list; viewport_list = viewport_list->next)
|
||||||
{
|
{
|
||||||
struct wps_viewport *wps_vp = &(data->viewports[v]);
|
struct skin_viewport *skin_viewport =
|
||||||
|
(struct skin_viewport *)viewport_list->token->value.data;
|
||||||
unsigned vp_refresh_mode = refresh_mode;
|
unsigned vp_refresh_mode = refresh_mode;
|
||||||
display->set_viewport(&wps_vp->vp);
|
display->set_viewport(&skin_viewport->vp);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
/* Set images to not to be displayed */
|
/* Set images to not to be displayed */
|
||||||
|
@ -998,27 +1014,27 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* dont redraw the viewport if its disabled */
|
/* dont redraw the viewport if its disabled */
|
||||||
if ((wps_vp->hidden_flags&VP_DRAW_HIDDEN))
|
if ((skin_viewport->hidden_flags&VP_DRAW_HIDDEN))
|
||||||
{
|
{
|
||||||
if (!(wps_vp->hidden_flags&VP_DRAW_WASHIDDEN))
|
if (!(skin_viewport->hidden_flags&VP_DRAW_WASHIDDEN))
|
||||||
display->scroll_stop(&wps_vp->vp);
|
display->scroll_stop(&skin_viewport->vp);
|
||||||
wps_vp->hidden_flags |= VP_DRAW_WASHIDDEN;
|
skin_viewport->hidden_flags |= VP_DRAW_WASHIDDEN;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (((wps_vp->hidden_flags&
|
else if (((skin_viewport->hidden_flags&
|
||||||
(VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE))
|
(VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE))
|
||||||
== (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE)))
|
== (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE)))
|
||||||
{
|
{
|
||||||
vp_refresh_mode = WPS_REFRESH_ALL;
|
vp_refresh_mode = WPS_REFRESH_ALL;
|
||||||
wps_vp->hidden_flags = VP_DRAW_HIDEABLE;
|
skin_viewport->hidden_flags = VP_DRAW_HIDEABLE;
|
||||||
}
|
}
|
||||||
if (vp_refresh_mode == WPS_REFRESH_ALL)
|
if (vp_refresh_mode == WPS_REFRESH_ALL)
|
||||||
{
|
{
|
||||||
display->clear_viewport();
|
display->clear_viewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (line = wps_vp->first_line;
|
for (line = skin_viewport->first_line;
|
||||||
line <= wps_vp->last_line; line++)
|
line <= skin_viewport->last_line; line++)
|
||||||
{
|
{
|
||||||
memset(linebuf, 0, sizeof(linebuf));
|
memset(linebuf, 0, sizeof(linebuf));
|
||||||
update_line = false;
|
update_line = false;
|
||||||
|
@ -1044,8 +1060,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
/* the peakmeter should be alone on its line */
|
/* the peakmeter should be alone on its line */
|
||||||
update_line = false;
|
update_line = false;
|
||||||
|
|
||||||
int h = font_get(wps_vp->vp.font)->height;
|
int h = font_get(skin_viewport->vp.font)->height;
|
||||||
int peak_meter_y = (line - wps_vp->first_line)* h;
|
int peak_meter_y = (line - skin_viewport->first_line)* h;
|
||||||
|
|
||||||
/* The user might decide to have the peak meter in the last
|
/* The user might decide to have the peak meter in the last
|
||||||
line so that it is only displayed if no status bar is
|
line so that it is only displayed if no status bar is
|
||||||
|
@ -1082,17 +1098,18 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
viewport there will be a blank line.
|
viewport there will be a blank line.
|
||||||
To get around this we dont allow any actual drawing to happen in the
|
To get around this we dont allow any actual drawing to happen in the
|
||||||
deault vp if other vp's are defined */
|
deault vp if other vp's are defined */
|
||||||
((data->num_viewports>1 && v!=0) || data->num_viewports == 1))
|
((skin_viewport->label != VP_DEFAULT_LABEL && viewport_list->next) ||
|
||||||
|
!viewport_list->next))
|
||||||
{
|
{
|
||||||
if (flags & WPS_REFRESH_SCROLL)
|
if (flags & WPS_REFRESH_SCROLL)
|
||||||
{
|
{
|
||||||
/* if the line is a scrolling one we don't want to update
|
/* if the line is a scrolling one we don't want to update
|
||||||
too often, so that it has the time to scroll */
|
too often, so that it has the time to scroll */
|
||||||
if ((vp_refresh_mode & WPS_REFRESH_SCROLL) || new_subline_refresh)
|
if ((vp_refresh_mode & WPS_REFRESH_SCROLL) || new_subline_refresh)
|
||||||
write_line(display, &align, line - wps_vp->first_line, true);
|
write_line(display, &align, line - skin_viewport->first_line, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write_line(display, &align, line - wps_vp->first_line, false);
|
write_line(display, &align, line - skin_viewport->first_line, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,13 +1117,13 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
/* progressbar */
|
/* progressbar */
|
||||||
if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS)
|
if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS)
|
||||||
{
|
{
|
||||||
if (wps_vp->pb)
|
if (skin_viewport->pb)
|
||||||
{
|
{
|
||||||
draw_progressbar(gwps, wps_vp);
|
draw_progressbar(gwps, skin_viewport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Now display any images in this viewport */
|
/* Now display any images in this viewport */
|
||||||
wps_display_images(gwps, &wps_vp->vp);
|
wps_display_images(gwps, &skin_viewport->vp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,9 @@ static int numoptions[WPS_MAX_COND_LEVEL];
|
||||||
/* the current line in the file */
|
/* the current line in the file */
|
||||||
static int line;
|
static int line;
|
||||||
|
|
||||||
|
/* the current viewport */
|
||||||
|
static struct skin_viewport *curr_vp;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
|
@ -419,10 +422,11 @@ static int parse_statusbar_enable(const char *wps_bufptr,
|
||||||
(void)token; /* Kill warnings */
|
(void)token; /* Kill warnings */
|
||||||
wps_data->wps_sb_tag = true;
|
wps_data->wps_sb_tag = true;
|
||||||
wps_data->show_sb_on_wps = true;
|
wps_data->show_sb_on_wps = true;
|
||||||
if (wps_data->viewports[0].vp.y == 0)
|
struct skin_viewport *default_vp = find_viewport(VP_DEFAULT_LABEL, wps_data);
|
||||||
|
if (default_vp->vp.y == 0)
|
||||||
{
|
{
|
||||||
wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
|
default_vp->vp.y = STATUSBAR_HEIGHT;
|
||||||
wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
|
default_vp->vp.height -= STATUSBAR_HEIGHT;
|
||||||
}
|
}
|
||||||
return skip_end_of_line(wps_bufptr);
|
return skip_end_of_line(wps_bufptr);
|
||||||
}
|
}
|
||||||
|
@ -434,10 +438,11 @@ static int parse_statusbar_disable(const char *wps_bufptr,
|
||||||
(void)token; /* Kill warnings */
|
(void)token; /* Kill warnings */
|
||||||
wps_data->wps_sb_tag = true;
|
wps_data->wps_sb_tag = true;
|
||||||
wps_data->show_sb_on_wps = false;
|
wps_data->show_sb_on_wps = false;
|
||||||
if (wps_data->viewports[0].vp.y == STATUSBAR_HEIGHT)
|
struct skin_viewport *default_vp = find_viewport(VP_DEFAULT_LABEL, wps_data);
|
||||||
|
if (default_vp->vp.y == STATUSBAR_HEIGHT)
|
||||||
{
|
{
|
||||||
wps_data->viewports[0].vp.y = 0;
|
default_vp->vp.y = 0;
|
||||||
wps_data->viewports[0].vp.height += STATUSBAR_HEIGHT;
|
default_vp->vp.height += STATUSBAR_HEIGHT;
|
||||||
}
|
}
|
||||||
return skip_end_of_line(wps_bufptr);
|
return skip_end_of_line(wps_bufptr);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +561,7 @@ static int parse_image_load(const char *wps_bufptr,
|
||||||
img->always_display = false;
|
img->always_display = false;
|
||||||
|
|
||||||
/* save current viewport */
|
/* save current viewport */
|
||||||
img->vp = &wps_data->viewports[wps_data->num_viewports].vp;
|
img->vp = &curr_vp->vp;
|
||||||
|
|
||||||
if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
|
if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
|
||||||
{
|
{
|
||||||
|
@ -612,13 +617,13 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
#endif
|
#endif
|
||||||
SCREEN_MAIN;
|
SCREEN_MAIN;
|
||||||
|
|
||||||
if (wps_data->num_viewports >= WPS_MAX_VIEWPORTS)
|
struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
|
||||||
|
|
||||||
wps_data->num_viewports++;
|
|
||||||
/* check for the optional letter to signify its a hideable viewport */
|
/* check for the optional letter to signify its a hideable viewport */
|
||||||
/* %Vl|<label>|<rest of tags>| */
|
/* %Vl|<label>|<rest of tags>| */
|
||||||
wps_data->viewports[wps_data->num_viewports].hidden_flags = 0;
|
skin_vp->hidden_flags = 0;
|
||||||
|
skin_vp->label = VP_NO_LABEL;
|
||||||
|
skin_vp->pb = NULL;
|
||||||
|
|
||||||
if (*ptr == 'l')
|
if (*ptr == 'l')
|
||||||
{
|
{
|
||||||
|
@ -627,8 +632,8 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
char label = *(ptr+2);
|
char label = *(ptr+2);
|
||||||
if (label >= 'a' && label <= 'z')
|
if (label >= 'a' && label <= 'z')
|
||||||
{
|
{
|
||||||
wps_data->viewports[wps_data->num_viewports].hidden_flags = VP_DRAW_HIDEABLE;
|
skin_vp->hidden_flags = VP_DRAW_HIDEABLE;
|
||||||
wps_data->viewports[wps_data->num_viewports].label = label;
|
skin_vp->label = label;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */
|
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */
|
||||||
|
@ -639,7 +644,7 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp;
|
struct viewport *vp = &skin_vp->vp;
|
||||||
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
|
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
|
||||||
|
|
||||||
if (!(ptr = viewport_parse_viewport(vp, screen, ptr, '|')))
|
if (!(ptr = viewport_parse_viewport(vp, screen, ptr, '|')))
|
||||||
|
@ -649,10 +654,9 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
if (*ptr != '|')
|
if (*ptr != '|')
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
|
curr_vp->last_line = wps_data->num_lines - 1;
|
||||||
|
|
||||||
wps_data->viewports[wps_data->num_viewports-1].last_line = wps_data->num_lines - 1;
|
skin_vp->first_line = wps_data->num_lines;
|
||||||
|
|
||||||
wps_data->viewports[wps_data->num_viewports].first_line = wps_data->num_lines;
|
|
||||||
|
|
||||||
if (wps_data->num_sublines < WPS_MAX_SUBLINES)
|
if (wps_data->num_sublines < WPS_MAX_SUBLINES)
|
||||||
{
|
{
|
||||||
|
@ -663,6 +667,11 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
wps_data->num_tokens;
|
wps_data->num_tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct skin_token_list *list = new_skin_token_list_item(NULL, skin_vp);
|
||||||
|
if (!list)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
add_to_ll_chain(&wps_data->viewports, list);
|
||||||
|
curr_vp = skin_vp;
|
||||||
/* Skip the rest of the line */
|
/* Skip the rest of the line */
|
||||||
return skip_end_of_line(wps_bufptr);
|
return skip_end_of_line(wps_bufptr);
|
||||||
}
|
}
|
||||||
|
@ -818,14 +827,13 @@ static int parse_progressbar(const char *wps_bufptr,
|
||||||
if (!pb || !item)
|
if (!pb || !item)
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp;
|
struct viewport *vp = &curr_vp->vp;
|
||||||
#ifndef __PCTOOL__
|
#ifndef __PCTOOL__
|
||||||
int font_height = font_get(vp->font)->height;
|
int font_height = font_get(vp->font)->height;
|
||||||
#else
|
#else
|
||||||
int font_height = 8;
|
int font_height = 8;
|
||||||
#endif
|
#endif
|
||||||
int line_num = wps_data->num_lines -
|
int line_num = wps_data->num_lines - curr_vp->first_line;
|
||||||
wps_data->viewports[wps_data->num_viewports].first_line;
|
|
||||||
|
|
||||||
pb->have_bitmap_pb = false;
|
pb->have_bitmap_pb = false;
|
||||||
pb->bm.data = NULL; /* no bitmap specified */
|
pb->bm.data = NULL; /* no bitmap specified */
|
||||||
|
@ -837,7 +845,7 @@ static int parse_progressbar(const char *wps_bufptr,
|
||||||
pb->height = SYSFONT_HEIGHT-2;
|
pb->height = SYSFONT_HEIGHT-2;
|
||||||
pb->y = -line_num - 1; /* Will be computed during the rendering */
|
pb->y = -line_num - 1; /* Will be computed during the rendering */
|
||||||
|
|
||||||
wps_data->viewports[wps_data->num_viewports].pb = pb;
|
curr_vp->pb = pb;
|
||||||
add_to_ll_chain(&wps_data->progressbars, item);
|
add_to_ll_chain(&wps_data->progressbars, item);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -882,7 +890,7 @@ static int parse_progressbar(const char *wps_bufptr,
|
||||||
else
|
else
|
||||||
pb->y = -line_num - 1; /* Will be computed during the rendering */
|
pb->y = -line_num - 1; /* Will be computed during the rendering */
|
||||||
|
|
||||||
wps_data->viewports[wps_data->num_viewports].pb = pb;
|
curr_vp->pb = pb;
|
||||||
add_to_ll_chain(&wps_data->progressbars, item);
|
add_to_ll_chain(&wps_data->progressbars, item);
|
||||||
|
|
||||||
/* Skip the rest of the line */
|
/* Skip the rest of the line */
|
||||||
|
@ -1154,7 +1162,7 @@ static int parse_touchregion(const char *wps_bufptr,
|
||||||
region->y = y;
|
region->y = y;
|
||||||
region->width = w;
|
region->width = w;
|
||||||
region->height = h;
|
region->height = h;
|
||||||
region->wvp = &wps_data->viewports[wps_data->num_viewports];
|
region->wvp = curr_vp;
|
||||||
|
|
||||||
if(!strncmp(pb_string, action, sizeof(pb_string)-1)
|
if(!strncmp(pb_string, action, sizeof(pb_string)-1)
|
||||||
&& *(action + sizeof(pb_string)-1) == '|')
|
&& *(action + sizeof(pb_string)-1) == '|')
|
||||||
|
@ -1282,7 +1290,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
|
||||||
level = -1;
|
level = -1;
|
||||||
|
|
||||||
while(*wps_bufptr && !fail && data->num_tokens < WPS_MAX_TOKENS - 1
|
while(*wps_bufptr && !fail && data->num_tokens < WPS_MAX_TOKENS - 1
|
||||||
&& data->num_viewports < WPS_MAX_VIEWPORTS
|
|
||||||
&& data->num_lines < WPS_MAX_LINES)
|
&& data->num_lines < WPS_MAX_LINES)
|
||||||
{
|
{
|
||||||
switch(*wps_bufptr++)
|
switch(*wps_bufptr++)
|
||||||
|
@ -1481,10 +1488,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
|
||||||
/* one of the limits of the while loop was exceeded */
|
/* one of the limits of the while loop was exceeded */
|
||||||
fail = PARSE_FAIL_LIMITS_EXCEEDED;
|
fail = PARSE_FAIL_LIMITS_EXCEEDED;
|
||||||
|
|
||||||
data->viewports[data->num_viewports].last_line = data->num_lines - 1;
|
curr_vp->last_line = data->num_lines - 1;
|
||||||
|
|
||||||
/* We have finished with the last viewport, so increment count */
|
|
||||||
data->num_viewports++;
|
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(SIMULATOR)
|
#if defined(DEBUG) || defined(SIMULATOR)
|
||||||
print_debug_info(data, fail, line);
|
print_debug_info(data, fail, line);
|
||||||
|
@ -1611,34 +1615,46 @@ bool skin_data_load(struct wps_data *wps_data,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wps_reset(wps_data);
|
wps_reset(wps_data);
|
||||||
|
|
||||||
|
curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
|
||||||
|
if (!curr_vp)
|
||||||
|
return false;
|
||||||
|
struct skin_token_list *list = new_skin_token_list_item(NULL, curr_vp);
|
||||||
|
if (!list)
|
||||||
|
return false;
|
||||||
|
add_to_ll_chain(&wps_data->viewports, list);
|
||||||
|
|
||||||
|
|
||||||
/* Initialise the first (default) viewport */
|
/* Initialise the first (default) viewport */
|
||||||
wps_data->viewports[0].vp.x = 0;
|
curr_vp->label = VP_DEFAULT_LABEL;
|
||||||
wps_data->viewports[0].vp.width = display->getwidth();
|
curr_vp->vp.x = 0;
|
||||||
wps_data->viewports[0].vp.height = display->getheight();
|
curr_vp->vp.width = display->getwidth();
|
||||||
|
curr_vp->vp.height = display->getheight();
|
||||||
|
curr_vp->pb = NULL;
|
||||||
|
curr_vp->hidden_flags = 0;
|
||||||
switch (statusbar_position(display->screen_type))
|
switch (statusbar_position(display->screen_type))
|
||||||
{
|
{
|
||||||
case STATUSBAR_OFF:
|
case STATUSBAR_OFF:
|
||||||
wps_data->viewports[0].vp.y = 0;
|
curr_vp->vp.y = 0;
|
||||||
break;
|
break;
|
||||||
case STATUSBAR_TOP:
|
case STATUSBAR_TOP:
|
||||||
wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
|
curr_vp->vp.y = STATUSBAR_HEIGHT;
|
||||||
wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
|
curr_vp->vp.height -= STATUSBAR_HEIGHT;
|
||||||
break;
|
break;
|
||||||
case STATUSBAR_BOTTOM:
|
case STATUSBAR_BOTTOM:
|
||||||
wps_data->viewports[0].vp.y = 0;
|
curr_vp->vp.y = 0;
|
||||||
wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
|
curr_vp->vp.height -= STATUSBAR_HEIGHT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
wps_data->viewports[0].vp.font = FONT_UI;
|
curr_vp->vp.font = FONT_UI;
|
||||||
wps_data->viewports[0].vp.drawmode = DRMODE_SOLID;
|
curr_vp->vp.drawmode = DRMODE_SOLID;
|
||||||
#endif
|
#endif
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
if (display->depth > 1)
|
if (display->depth > 1)
|
||||||
{
|
{
|
||||||
wps_data->viewports[0].vp.fg_pattern = display->get_foreground();
|
curr_vp->vp.fg_pattern = display->get_foreground();
|
||||||
wps_data->viewports[0].vp.bg_pattern = display->get_background();
|
curr_vp->vp.bg_pattern = display->get_background();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!isfile)
|
if (!isfile)
|
||||||
|
|
|
@ -495,12 +495,13 @@ static void dump_wps_tokens(struct wps_data *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* NOTE: this is probaly not even needed anymore */
|
||||||
static void print_line_info(struct wps_data *data)
|
static void print_line_info(struct wps_data *data)
|
||||||
{
|
{
|
||||||
int i, j, v;
|
int i, j, v;
|
||||||
struct wps_line *line;
|
struct wps_line *line;
|
||||||
struct wps_subline *subline;
|
struct wps_subline *subline;
|
||||||
|
|
||||||
if (wps_verbose_level > 0)
|
if (wps_verbose_level > 0)
|
||||||
{
|
{
|
||||||
DEBUGF("Number of viewports : %d\n", data->num_viewports);
|
DEBUGF("Number of viewports : %d\n", data->num_viewports);
|
||||||
|
@ -513,7 +514,7 @@ static void print_line_info(struct wps_data *data)
|
||||||
DEBUGF("Number of tokens : %d\n", data->num_tokens);
|
DEBUGF("Number of tokens : %d\n", data->num_tokens);
|
||||||
DEBUGF("\n");
|
DEBUGF("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wps_verbose_level > 1)
|
if (wps_verbose_level > 1)
|
||||||
{
|
{
|
||||||
for (v = 0; v < data->num_viewports; v++)
|
for (v = 0; v < data->num_viewports; v++)
|
||||||
|
@ -549,8 +550,6 @@ static void print_line_info(struct wps_data *data)
|
||||||
DEBUGF("\n");
|
DEBUGF("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
/* NOTE: this is probaly not even needed anymore */
|
|
||||||
static void print_wps_strings(struct wps_data *data)
|
static void print_wps_strings(struct wps_data *data)
|
||||||
{
|
{
|
||||||
int i, len, total_len = 0, buf_used = 0;
|
int i, len, total_len = 0, buf_used = 0;
|
||||||
|
@ -588,7 +587,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
|
||||||
{
|
{
|
||||||
dump_wps_tokens(data);
|
dump_wps_tokens(data);
|
||||||
/* print_wps_strings(data); */
|
/* print_wps_strings(data); */
|
||||||
print_line_info(data);
|
/* print_line_info(data); */
|
||||||
}
|
}
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,9 @@ struct wps_line {
|
||||||
#define VP_DRAW_HIDEABLE 0x1
|
#define VP_DRAW_HIDEABLE 0x1
|
||||||
#define VP_DRAW_HIDDEN 0x2
|
#define VP_DRAW_HIDDEN 0x2
|
||||||
#define VP_DRAW_WASHIDDEN 0x4
|
#define VP_DRAW_WASHIDDEN 0x4
|
||||||
struct wps_viewport {
|
#define VP_DEFAULT_LABEL '|'
|
||||||
|
#define VP_NO_LABEL '-'
|
||||||
|
struct skin_viewport {
|
||||||
struct viewport vp; /* The LCD viewport struct */
|
struct viewport vp; /* The LCD viewport struct */
|
||||||
struct progressbar *pb;
|
struct progressbar *pb;
|
||||||
/* Indexes of the first and last lines belonging to this viewport in the
|
/* Indexes of the first and last lines belonging to this viewport in the
|
||||||
|
@ -203,7 +205,7 @@ struct wps_viewport {
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
struct touchregion {
|
struct touchregion {
|
||||||
struct wps_viewport* wvp;/* The viewport this region is in */
|
struct skin_viewport* wvp;/* The viewport this region is in */
|
||||||
short int x; /* x-pos */
|
short int x; /* x-pos */
|
||||||
short int y; /* y-pos */
|
short int y; /* y-pos */
|
||||||
short int width; /* width */
|
short int width; /* width */
|
||||||
|
@ -262,8 +264,7 @@ struct wps_data
|
||||||
int num_lines;
|
int num_lines;
|
||||||
|
|
||||||
/* Number of viewports in the WPS */
|
/* Number of viewports in the WPS */
|
||||||
int num_viewports;
|
struct skin_token_list *viewports;
|
||||||
struct wps_viewport viewports[WPS_MAX_VIEWPORTS];
|
|
||||||
|
|
||||||
struct wps_line lines[WPS_MAX_LINES];
|
struct wps_line lines[WPS_MAX_LINES];
|
||||||
|
|
||||||
|
@ -346,5 +347,6 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
|
|
||||||
|
|
||||||
struct gui_img* find_image(int n, struct wps_data *data);
|
struct gui_img* find_image(int n, struct wps_data *data);
|
||||||
|
struct skin_viewport* find_viewport(char label, struct wps_data *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1239,7 +1239,7 @@ static void statusbar_toggle_handler(void *data)
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
struct viewport *vp = &gui_wps[i].data->viewports[0].vp;
|
struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, &wps_datas[i])->vp;
|
||||||
bool draw = wpsbars & (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
|
bool draw = wpsbars & (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
|
||||||
if (!draw)
|
if (!draw)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue