Centralise icon enabling to hopefully save a few bytes

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12540 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2007-03-01 18:25:13 +00:00
parent 44c510e185
commit 361a60c964
3 changed files with 11 additions and 17 deletions

View file

@ -222,7 +222,7 @@ static void gui_list_draw(struct gui_list * gui_list)
int cursor_pos = 0;
int icon_pos = 1;
int text_pos;
bool draw_icons = (gui_list->callback_get_item_icon != NULL ) ;
bool draw_icons = (gui_list->callback_get_item_icon != NULL && global_settings.show_icons);
bool draw_cursor;
int i;
int lines;
@ -238,7 +238,7 @@ static void gui_list_draw(struct gui_list * gui_list)
i = 1;
lines = display->nb_lines - 1;
if (gui_list->title_icon != NOICON)
if (gui_list->title_icon != NOICON && draw_icons)
{
screen_put_iconxy(display, 0, 0, gui_list->title_icon);
#ifdef HAVE_LCD_BITMAP

View file

@ -415,20 +415,16 @@ static void init_menu_lists(const struct menu_item_ex *menu,
gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1);
#ifdef HAVE_LCD_BITMAP
if (global_settings.show_icons == false)
icon = NOICON;
else if (menu->callback_and_desc->icon == NOICON)
if (menu->callback_and_desc->icon == NOICON)
icon = bitmap_icons_6x8[Icon_Submenu_Entered];
else
icon = menu->callback_and_desc->icon;
gui_synclist_set_title(lists, P2STR(menu->callback_and_desc->desc), icon);
if (global_settings.show_icons)
gui_synclist_set_icon_callback(lists, menu_get_icon);
else
gui_synclist_set_icon_callback(lists, menu_get_icon);
#else
(void)icon;
gui_synclist_set_icon_callback(lists, NULL);
#endif
gui_synclist_set_icon_callback(lists, NULL);
gui_synclist_set_nb_items(lists,current_subitems_count);
gui_synclist_limit_scroll(lists,true);
gui_synclist_select_item(lists, find_menu_selection(selected));

View file

@ -272,8 +272,7 @@ void browse_root(void)
gui_buttonbar_set_display(&tree_buttonbar, &(screens[SCREEN_MAIN]) );
#endif
gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1);
gui_synclist_set_icon_callback(&tree_lists,
global_settings.show_icons?&tree_get_fileicon:NULL);
gui_synclist_set_icon_callback(&tree_lists, &tree_get_fileicon);
/* not the best place for this call... but... */
root_menu();
}
@ -377,7 +376,7 @@ static int update_dir(void)
|| global_settings.show_path_in_browser == SHOW_PATH_CURRENT)
{
gui_synclist_set_title(&tree_lists, tagtree_get_title(&tc),
global_settings.show_icons?filetype_get_icon(ATTR_DIRECTORY):(ICON)NULL);
filetype_get_icon(ATTR_DIRECTORY));
}
else
{
@ -391,7 +390,7 @@ static int update_dir(void)
if (global_settings.show_path_in_browser == SHOW_PATH_FULL)
{
gui_synclist_set_title(&tree_lists, tc.currdir,
global_settings.show_icons?filetype_get_icon(ATTR_DIRECTORY):(ICON)NULL);
filetype_get_icon(ATTR_DIRECTORY));
}
else if (global_settings.show_path_in_browser == SHOW_PATH_CURRENT)
{
@ -400,11 +399,11 @@ static int update_dir(void)
{
/* Display "Files" for the root dir */
gui_synclist_set_title(&tree_lists, str(LANG_DIR_BROWSER),
global_settings.show_icons?filetype_get_icon(ATTR_DIRECTORY):(ICON)NULL);
filetype_get_icon(ATTR_DIRECTORY));
}
else
gui_synclist_set_title(&tree_lists, title,
global_settings.show_icons?filetype_get_icon(ATTR_DIRECTORY):(ICON)NULL);
filetype_get_icon(ATTR_DIRECTORY));
}
else
{
@ -414,8 +413,7 @@ static int update_dir(void)
}
gui_synclist_set_nb_items(&tree_lists, tc.filesindir);
gui_synclist_set_icon_callback(&tree_lists,
global_settings.show_icons?&tree_get_fileicon:NULL);
gui_synclist_set_icon_callback(&tree_lists, tree_get_fileicon);
if( tc.selected_item >= tc.filesindir)
tc.selected_item=tc.filesindir-1;