From 256bf063872f4c1d334f2a94cd42976bfd260d2e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 11 Sep 2008 19:33:40 +0000 Subject: Basic throbber support code. The throbber is shared between windows and must be stored as Resources/Throbber in animation.datatype supported format. The default animation is a small IFF ANIM which is only good for testing purposes. This throbber code is likely to be replaced by custom animation code in the future as using animation.datatype has issues and restrictions (only 8-bit formats, using NewDTObject() twice on the same file doesn't seem to work correctly, clicking on the anim starts it playing etc) svn path=/trunk/netsurf/; revision=5303 --- amiga/gui.c | 36 ++++++++++++++++++++++++++++++++++-- amiga/gui.h | 2 +- amiga/resources/Throbber | Bin 0 -> 924 bytes 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 amiga/resources/Throbber diff --git a/amiga/gui.c b/amiga/gui.c index 9702fe651..784fb1269 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "desktop/selection.h" #include "utils/utf8.h" #include "amiga/utf8.h" @@ -55,6 +56,7 @@ #include #include #include "amiga/iff_cset.h" +#include #ifdef WITH_HUBBUB #include @@ -93,6 +95,8 @@ struct TimerIFace *ITimer; struct Library *PopupMenuBase = NULL; struct PopupMenuIFace *IPopupMenu = NULL; +Object *throbber = NULL; + bool win_destroyed = false; static struct RastPort dummyrp; struct IFFHandle *iffh = NULL; @@ -141,6 +145,14 @@ void gui_init(int argc, char** argv) struct RastPort mouseptr; struct IFFHandle *mpiff = NULL; +/* ttengine.library + if(!ami_open_tte()) + { + char errormsg[100]; + die(sprintf(errormsg,"%s ttengine.library",messages_get("OpenError"))); + } +*/ + msgport = AllocSysObjectTags(ASOT_PORT, ASO_NoTrack,FALSE, TAG_DONE); @@ -179,6 +191,14 @@ void gui_init(int argc, char** argv) } } + throbber = NewDTObject("Resources/Throbber", + GA_ID,OID_THROBBER, + GA_ReadOnly,TRUE, + DTA_ControlPanel,FALSE, + DTA_Repeat,TRUE, + DTA_GroupID,GID_ANIMATION, + TAG_DONE); + InitRastPort(&mouseptr); for(i=0;i<=AMI_LASTPOINTER;i++) @@ -831,6 +851,8 @@ void gui_quit(void) { int i; + DisposeDTObject(throbber); + urldb_save(option_url_file); urldb_save_cookies(option_cookie_file); options_save_tree(hotlist,option_hotlist_file,messages_get("TreeHotlist")); @@ -876,6 +898,8 @@ void gui_quit(void) FreeObjList(schedule_list); FreeObjList(window_list); + +// ami_close_tte(); } void ami_update_buttons(struct gui_window *gwin) @@ -1102,6 +1126,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, GA_ID,GID_URL, GA_RelVerify,TRUE, StringEnd, + LAYOUT_AddChild,throbber, + CHILD_NoDispose,TRUE, LayoutEnd, CHILD_WeightedHeight,0, LAYOUT_AddChild, gwin->gadgets[GID_BROWSER] = SpaceObject, @@ -1149,7 +1175,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, InitRastPort(&gwin->rp); gwin->rp.BitMap = gwin->bm; - SetDrMd(currp,BGBACKFILL); + SetDrMd(&gwin->rp,BGBACKFILL); gwin->layerinfo = NewLayerInfo(); gwin->rp.Layer = CreateUpfrontLayer(gwin->layerinfo,gwin->bm,0,0,scrn->Width-1,scrn->Height-1,0,NULL); @@ -1177,7 +1203,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, InitTmpRas(gwin->rp.TmpRas,gwin->tmprasbuf,scrn->Width*scrn->Height); - GetRPAttrs(&gwin->rp,RPTAG_Font,&origrpfont,TAG_DONE); +// GetRPAttrs(&gwin->rp,RPTAG_Font,&origrpfont,TAG_DONE); + +// ami_tte_setdefaults(&gwin->rp,gwin->win); GetAttr(WINDOW_HorizObject,gwin->objects[OID_MAIN],(ULONG *)&gwin->objects[OID_HSCROLL]); GetAttr(WINDOW_VertObject,gwin->objects[OID_MAIN],(ULONG *)&gwin->objects[OID_VSCROLL]); @@ -1203,9 +1231,11 @@ void gui_window_destroy(struct gui_window *g) { if(!g) return; +// DisposeDTObject(g->gadgets[GID_THROBBER]); DisposeObject(g->objects[OID_MAIN]); DeleteLayer(0,g->rp.Layer); DisposeLayerInfo(g->layerinfo); +// ami_tte_cleanup(&g->rp); p96FreeBitMap(g->bm); FreeVec(g->rp.TmpRas); FreeVec(g->rp.AreaInfo); @@ -1520,10 +1550,12 @@ void gui_window_set_url(struct gui_window *g, const char *url) void gui_window_start_throbber(struct gui_window *g) { + IDoMethod(throbber,ADTM_START,0); // g->objects[OID_THROBBER] } void gui_window_stop_throbber(struct gui_window *g) { + IDoMethod(throbber,ADTM_STOP,0); } void gui_window_place_caret(struct gui_window *g, int x, int y, int height) diff --git a/amiga/gui.h b/amiga/gui.h index 4a96d98cd..b91fd7424 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -37,7 +37,6 @@ enum GID_HOME, GID_BACK, GID_FORWARD, - GID_THROBBER, GID_USER, GID_PASS, GID_LOGIN, @@ -51,6 +50,7 @@ enum OID_VSCROLL, OID_HSCROLL, OID_MENU, + OID_THROBBER, OID_LAST }; diff --git a/amiga/resources/Throbber b/amiga/resources/Throbber new file mode 100644 index 000000000..9ed182854 Binary files /dev/null and b/amiga/resources/Throbber differ -- cgit v1.2.3