Put a search icon where the old search favicon was

svn path=/trunk/netsurf/; revision=12558
This commit is contained in:
Chris Young 2011-07-02 19:38:54 +00:00
parent b415e6dabc
commit 910c6d314f
7 changed files with 51 additions and 1 deletions

View File

@ -306,6 +306,36 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
return dto;
}
/* Quick way to get an object on disk into a struct bitmap */
struct bitmap *ami_bitmap_from_datatype(char *filename)
{
Object *dto;
struct bitmap *bm;
if(dto = NewDTObject(filename,
DTA_GroupID, GID_PICTURE,
PDTA_DestMode, PMODE_V43,
TAG_DONE))
{
struct BitMapHeader *bmh;
struct RastPort rp;
if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE))
{
bm = bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
IDoMethod(dto, PDTM_READPIXELARRAY, bitmap_get_buffer(bm),
PBPAFMT_RGBA, bitmap_get_rowstride(bm), 0, 0,
bmh->bmh_Width, bmh->bmh_Height);
}
DisposeDTObject(dto);
}
return bm;
}
struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm)
{
struct RenderInfo ri;

View File

@ -41,4 +41,5 @@ struct bitmap {
struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm);
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
#endif

View File

@ -3749,14 +3749,30 @@ void gui_window_set_search_ico(hlcache_handle *ico)
struct nsObject *node;
struct nsObject *nnode;
struct gui_window_2 *gwin;
char fname[100];
struct bitmap *nsbm;
bool free_bm = false;
if(IsMinListEmpty(window_list)) return;
if(option_kiosk_mode == true) return;
/* disabled, as at the moment, favicon/search icons don't work
if (ico == NULL) ico = search_web_ico();
if ((ico != NULL) && (content_get_bitmap(ico) != NULL))
{
bm = ami_getcachenativebm(content_get_bitmap(ico), 16, 16, NULL);
}
*/
/* generic search image */
if(bm == NULL)
{
ami_get_theme_filename(&fname, "theme_search", false);
if(nsbm = ami_bitmap_from_datatype(fname))
{
bm = ami_getcachenativebm(nsbm, 16, 16, NULL);
}
free_bm = true;
}
node = (struct nsObject *)GetHead((struct List *)window_list);
@ -3794,6 +3810,8 @@ void gui_window_set_search_ico(hlcache_handle *ico)
}
}
} while(node = nnode);
if(bm && free_bm) bitmap_destroy(nsbm);
}
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)

View File

@ -28,6 +28,7 @@ theme_throbber:Throbber
theme_throbber_frames:13
theme_throbber_delay:100
theme_tab_loading:*TBImages:list_download
theme_search:*TBImages:list_search
ptr_default:*PROGDIR:Resources/Pointers/Default
ptr_point:*PROGDIR:Resources/Pointers/Point
ptr_caret:*PROGDIR:Resources/Pointers/Caret

View File

@ -41,6 +41,7 @@ theme_throbber:Throbber
theme_throbber_frames:9
theme_throbber_delay:100
theme_tab_loading:
theme_search:search.png
ptr_default:*PROGDIR:Resources/Pointers/Default
ptr_point:*PROGDIR:Resources/Pointers/Point
ptr_caret:*PROGDIR:Resources/Pointers/Caret

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

View File

@ -145,7 +145,6 @@ void ami_theme_throbber_setup(void)
{
throbber_width = throbber_bmh->bmh_Width / throbber_frames;
throbber_height = throbber_bmh->bmh_Height;
throbber_bmh->bmh_Masking = mskHasAlpha;
InitRastPort(&throbber_rp);