summaryrefslogtreecommitdiffstats
path: root/apps/gui/bitmap/list.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2012-07-18 23:19:11 +0200
committerJonathan Gordon <rockbox@jdgordon.info>2012-07-19 01:21:10 +0200
commit08238178d3840b57e7a2e782fdf8182a2786870c (patch)
tree4ee1967c54dff88d71a8f9f64650bfe9dc06c020 /apps/gui/bitmap/list.c
parent323282f22dc1b510ae4a7c5e1a6de192f7df73d0 (diff)
downloadrockbox-08238178d3840b57e7a2e782fdf8182a2786870c.tar.gz
rockbox-08238178d3840b57e7a2e782fdf8182a2786870c.zip
lists: Support '\t' in list item text to indent the line containing it.
Change-Id: I1583371228ed477b504c135f81cb59a0c3c931e6 Reviewed-on: http://gerrit.rockbox.org/296 Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info> Tested-by: Jonathan Gordon <rockbox@jdgordon.info>
Diffstat (limited to 'apps/gui/bitmap/list.c')
-rw-r--r--apps/gui/bitmap/list.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index aad3eda98f..45e6c03dcf 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -154,6 +154,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
int icon_yoffset = 0; /* to center the icon */
bool show_title;
struct viewport *list_text_vp = &list_text[screen];
+ int indent = 0;
line_height = parent->line_height;
display->set_viewport(parent);
@@ -249,9 +250,28 @@ void list_draw(struct screen *display, struct gui_synclist *list)
unsigned char *entry_name;
int text_pos = 0;
int line = i - start;
+ indent = 0;
s = list->callback_get_item_name(i, list->data, entry_buffer,
sizeof(entry_buffer));
entry_name = P2STR(s);
+
+ while (*entry_name == '\t')
+ {
+ indent++;
+ entry_name++;
+ }
+ if (indent)
+ {
+ if (icon_width)
+ indent *= icon_width;
+ else
+ indent *= display->getcharwidth();
+
+ list_icons.x += indent;
+ list_text_vp->x += indent;
+ list_text_vp->width -= indent;
+ }
+
display->set_viewport(list_text_vp);
style = STYLE_DEFAULT;
/* position the string at the correct offset place */
@@ -353,6 +373,12 @@ void list_draw(struct screen *display, struct gui_synclist *list)
line*line_height + draw_offset + icon_yoffset,
Icon_Cursor);
}
+ if (indent)
+ {
+ list_icons.x -= indent;
+ list_text_vp->x -= indent;
+ list_text_vp->width += indent;
+ }
}
display->set_viewport(parent);
display->update_viewport();