From 910c6d314fc356a8b8628b3ff7b26c3ff289a4dd Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 2 Jul 2011 19:38:54 +0000 Subject: Put a search icon where the old search favicon was svn path=/trunk/netsurf/; revision=12558 --- amiga/bitmap.c | 30 ++++++++++++++++++++++++++++++ amiga/bitmap.h | 1 + amiga/gui.c | 18 ++++++++++++++++++ amiga/resources/Themes/AISS/Theme | 1 + amiga/resources/Themes/Default/Theme | 1 + amiga/resources/Themes/Default/search.png | Bin 0 -> 662 bytes amiga/theme.c | 1 - 7 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 amiga/resources/Themes/Default/search.png (limited to 'amiga') diff --git a/amiga/bitmap.c b/amiga/bitmap.c index 8807f7a23..d6895d2b3 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -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; diff --git a/amiga/bitmap.h b/amiga/bitmap.h index d2246d242..114eaf34a 100755 --- a/amiga/bitmap.h +++ b/amiga/bitmap.h @@ -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 diff --git a/amiga/gui.c b/amiga/gui.c index 0621bc9f4..ba6245feb 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -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) diff --git a/amiga/resources/Themes/AISS/Theme b/amiga/resources/Themes/AISS/Theme index abe1e676b..f515a89b0 100755 --- a/amiga/resources/Themes/AISS/Theme +++ b/amiga/resources/Themes/AISS/Theme @@ -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 diff --git a/amiga/resources/Themes/Default/Theme b/amiga/resources/Themes/Default/Theme index 28b38e006..ca6d0ea24 100755 --- a/amiga/resources/Themes/Default/Theme +++ b/amiga/resources/Themes/Default/Theme @@ -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 diff --git a/amiga/resources/Themes/Default/search.png b/amiga/resources/Themes/Default/search.png new file mode 100644 index 000000000..a59c12b8f Binary files /dev/null and b/amiga/resources/Themes/Default/search.png differ diff --git a/amiga/theme.c b/amiga/theme.c index 4f442f397..90973a863 100644 --- a/amiga/theme.c +++ b/amiga/theme.c @@ -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); -- cgit v1.2.3