mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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>
This commit is contained in:
parent
323282f22d
commit
08238178d3
1 changed files with 26 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue