From 3f5851f41f089696c91ba84259884513ee92d65c Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 14 Jun 2010 01:08:39 +0000 Subject: make the next line after a viewport (if it is on the same skin line) auto-eat the \n git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26837 a1c6a512-1295-4272-9138-f99709370657 --- utils/newparser/handle_tags.c | 18 +++++++++++++++++- utils/newparser/skin_render.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/utils/newparser/handle_tags.c b/utils/newparser/handle_tags.c index 3e49960686..a725a52396 100644 --- a/utils/newparser/handle_tags.c +++ b/utils/newparser/handle_tags.c @@ -123,7 +123,22 @@ int handle_tree(struct skin *skin, struct skin_element* tree, struct line *line) int counter; while (element) { - if (element->type == LINE) + if (element->type == VIEWPORT) + { + struct skin_element *next; + /* parse the viewport */ + /* if the next element is a LINE we need to set it to eat the line ending */ + next = element->children[0]; + if (element->tag && next->type == LINE && + element->line == next->line) + { + struct line *line = (struct line*)malloc(sizeof(struct line)); + line->update_mode = 0; + line->eat_line_ending = true; + next->data = line; + } + } + else if (element->type == LINE && !element->data) { struct line *line = (struct line*)malloc(sizeof(struct line)); line->update_mode = 0; @@ -164,6 +179,7 @@ int handle_tree(struct skin *skin, struct skin_element* tree, struct line *line) int ret = handle_tree(skin, element->children[counter], current_line); counter++; } + /* *probably* set current_line to NULL here */ element = element->next; } return 0; diff --git a/utils/newparser/skin_render.c b/utils/newparser/skin_render.c index dfcc4b89ea..f39e6f6c45 100644 --- a/utils/newparser/skin_render.c +++ b/utils/newparser/skin_render.c @@ -111,7 +111,7 @@ void skin_render_viewport(struct skin_element* viewport, bool draw_tags) func(line, linebuf, sizeof(linebuf), line_number); if (draw_tags) { - printf("%s", linebuf); + printf("[%d]%s", line_number, linebuf); if (!((struct line*)line->data)->eat_line_ending) { printf("\n"); -- cgit v1.2.3