summaryrefslogtreecommitdiff
path: root/apps
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
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')
-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)
154 int icon_yoffset = 0; /* to center the icon */ 154 int icon_yoffset = 0; /* to center the icon */
155 bool show_title; 155 bool show_title;
156 struct viewport *list_text_vp = &list_text[screen]; 156 struct viewport *list_text_vp = &list_text[screen];
157 int indent = 0;
157 158
158 line_height = parent->line_height; 159 line_height = parent->line_height;
159 display->set_viewport(parent); 160 display->set_viewport(parent);
@@ -249,9 +250,28 @@ void list_draw(struct screen *display, struct gui_synclist *list)
249 unsigned char *entry_name; 250 unsigned char *entry_name;
250 int text_pos = 0; 251 int text_pos = 0;
251 int line = i - start; 252 int line = i - start;
253 indent = 0;
252 s = list->callback_get_item_name(i, list->data, entry_buffer, 254 s = list->callback_get_item_name(i, list->data, entry_buffer,
253 sizeof(entry_buffer)); 255 sizeof(entry_buffer));
254 entry_name = P2STR(s); 256 entry_name = P2STR(s);
257
258 while (*entry_name == '\t')
259 {
260 indent++;
261 entry_name++;
262 }
263 if (indent)
264 {
265 if (icon_width)
266 indent *= icon_width;
267 else
268 indent *= display->getcharwidth();
269
270 list_icons.x += indent;
271 list_text_vp->x += indent;
272 list_text_vp->width -= indent;
273 }
274
255 display->set_viewport(list_text_vp); 275 display->set_viewport(list_text_vp);
256 style = STYLE_DEFAULT; 276 style = STYLE_DEFAULT;
257 /* position the string at the correct offset place */ 277 /* position the string at the correct offset place */
@@ -353,6 +373,12 @@ void list_draw(struct screen *display, struct gui_synclist *list)
353 line*line_height + draw_offset + icon_yoffset, 373 line*line_height + draw_offset + icon_yoffset,
354 Icon_Cursor); 374 Icon_Cursor);
355 } 375 }
376 if (indent)
377 {
378 list_icons.x -= indent;
379 list_text_vp->x -= indent;
380 list_text_vp->width += indent;
381 }
356 } 382 }
357 display->set_viewport(parent); 383 display->set_viewport(parent);
358 display->update_viewport(); 384 display->update_viewport();