diff options
author | Dan Everton <dan@iocaine.org> | 2006-08-15 12:23:55 +0000 |
---|---|---|
committer | Dan Everton <dan@iocaine.org> | 2006-08-15 12:23:55 +0000 |
commit | c0f8b187706364f5e4bda2ac26750d14454c901d (patch) | |
tree | 7328f5562f6dc7cefa8b3f4504b4cde9ddf89fd5 /apps | |
parent | 8570911e4ee0ec30ce73581518ad9b5afe00a15e (diff) | |
download | rockbox-c0f8b187706364f5e4bda2ac26750d14454c901d.tar.gz rockbox-c0f8b187706364f5e4bda2ac26750d14454c901d.zip |
A few changes and fixes for the title in the file view: disable title string in tagcache view, strip leading / from current directory title, center title properly, scroll title if it's too long.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10581 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/list.c | 29 | ||||
-rw-r--r-- | apps/gui/list.h | 4 | ||||
-rw-r--r-- | apps/tree.c | 11 |
3 files changed, 32 insertions, 12 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 98b0148c14..b17e01ed90 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -68,6 +68,7 @@ void gui_list_init(struct gui_list * gui_list, | |||
68 | gui_list->scroll_all=scroll_all; | 68 | gui_list->scroll_all=scroll_all; |
69 | gui_list->selected_size=selected_size; | 69 | gui_list->selected_size=selected_size; |
70 | gui_list->title = NULL; | 70 | gui_list->title = NULL; |
71 | gui_list->title_width = 0; | ||
71 | } | 72 | } |
72 | 73 | ||
73 | void gui_list_set_display(struct gui_list * gui_list, struct screen * display) | 74 | void gui_list_set_display(struct gui_list * gui_list, struct screen * display) |
@@ -305,15 +306,22 @@ void gui_list_draw(struct gui_list * gui_list) | |||
305 | gui_list->start_item, | 306 | gui_list->start_item, |
306 | gui_list->start_item + display->nb_lines, VERTICAL); | 307 | gui_list->start_item + display->nb_lines, VERTICAL); |
307 | } | 308 | } |
309 | #endif | ||
308 | if (gui_list->title) | 310 | if (gui_list->title) |
309 | { | 311 | { |
310 | int start = ((display->width/display->char_width) - strlen(gui_list->title))/2; | 312 | /* Scroll if the title is too large, otherwise center */ |
311 | display->puts(start, 0, gui_list->title); | 313 | if (gui_list->title_width > gui_list->display->width) { |
312 | } | 314 | display->puts_scroll(0, 0, gui_list->title); |
313 | #else /* char cell display */ | 315 | } else { |
314 | if (gui_list->title) | 316 | #ifdef HAVE_LCD_BITMAP |
315 | display->puts(0, 0, gui_list->title); /* dont center title */ | 317 | display->putsxy((display->width - gui_list->title_width) / 2, |
318 | gui_textarea_get_ystart(display), gui_list->title); | ||
319 | #else | ||
320 | display->puts((display->width - gui_list->title_width) / 2, 0, | ||
321 | gui_list->title); | ||
316 | #endif | 322 | #endif |
323 | } | ||
324 | } | ||
317 | gui_textarea_update(display); | 325 | gui_textarea_update(display); |
318 | } | 326 | } |
319 | 327 | ||
@@ -513,10 +521,17 @@ void gui_list_screen_scroll_out_of_view(bool enable) | |||
513 | offset_out_of_view = false; | 521 | offset_out_of_view = false; |
514 | } | 522 | } |
515 | #endif /* HAVE_LCD_BITMAP */ | 523 | #endif /* HAVE_LCD_BITMAP */ |
516 | void gui_list_set_title(struct gui_list *gui_list , char* title) | 524 | |
525 | void gui_list_set_title(struct gui_list * gui_list, char * title) | ||
517 | { | 526 | { |
518 | gui_list->title = title; | 527 | gui_list->title = title; |
528 | #ifdef HAVE_LCD_BITMAP | ||
529 | gui_list->display->getstringsize(title, &gui_list->title_width, NULL); | ||
530 | #else | ||
531 | gui_list->title_width = strlen(title); | ||
532 | #endif | ||
519 | } | 533 | } |
534 | |||
520 | /* | 535 | /* |
521 | * Synchronized lists stuffs | 536 | * Synchronized lists stuffs |
522 | */ | 537 | */ |
diff --git a/apps/gui/list.h b/apps/gui/list.h index 447e0d832d..8d3ac9ad4c 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -170,6 +170,8 @@ struct gui_list | |||
170 | void * data; | 170 | void * data; |
171 | /* The optional title, set to NULL for none */ | 171 | /* The optional title, set to NULL for none */ |
172 | char *title; | 172 | char *title; |
173 | /* Cache the width of the title string in pixels/characters */ | ||
174 | int title_width; | ||
173 | }; | 175 | }; |
174 | 176 | ||
175 | /* | 177 | /* |
@@ -337,7 +339,7 @@ extern void gui_list_flash(struct gui_list * gui_list); | |||
337 | /* | 339 | /* |
338 | * Set the title of the list, setting to NULL disables the title | 340 | * Set the title of the list, setting to NULL disables the title |
339 | */ | 341 | */ |
340 | extern void gui_list_set_title(struct gui_list *gui_list , char* title); | 342 | extern void gui_list_set_title(struct gui_list *gui_list, char* title); |
341 | /* | 343 | /* |
342 | * This part handles as many lists as there are connected screens | 344 | * This part handles as many lists as there are connected screens |
343 | * (the api is similar to the ones above) | 345 | * (the api is similar to the ones above) |
diff --git a/apps/tree.c b/apps/tree.c index 72e62caf2b..2f1d140ad9 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -347,10 +347,13 @@ static int update_dir(void) | |||
347 | gui_syncsplash(HZ, true, str(LANG_SHOWDIR_BUFFER_FULL)); | 347 | gui_syncsplash(HZ, true, str(LANG_SHOWDIR_BUFFER_FULL)); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | if (global_settings.show_path_in_browser == SHOW_PATH_FULL) { | 350 | if (!id3db) { |
351 | gui_synclist_set_title(&tree_lists, tc.currdir); | 351 | if (global_settings.show_path_in_browser == SHOW_PATH_FULL) { |
352 | } else if (global_settings.show_path_in_browser == SHOW_PATH_CURRENT) { | 352 | gui_synclist_set_title(&tree_lists, tc.currdir); |
353 | gui_synclist_set_title(&tree_lists, strrchr(tc.currdir, '/')); | 353 | } else if (global_settings.show_path_in_browser == SHOW_PATH_CURRENT) { |
354 | gui_synclist_set_title(&tree_lists, | ||
355 | tc.dirlevel > 0 ? strrchr(tc.currdir, '/') + 1 : "/"); | ||
356 | } | ||
354 | } | 357 | } |
355 | gui_synclist_set_nb_items(&tree_lists, tc.filesindir); | 358 | gui_synclist_set_nb_items(&tree_lists, tc.filesindir); |
356 | gui_synclist_set_icon_callback(&tree_lists, | 359 | gui_synclist_set_icon_callback(&tree_lists, |