IPTR ModelClass__OM_UPDATE(Class *cl, Object *o, struct opUpdate *msg) { struct ModelData *data = (struct ModelData *)INST_DATA(cl, o); /* send OM_UPDATE to all members without mapping the tags! */ if (!IsListEmpty((struct List *)&data->memberlist)) { STACKULONG method = ICM_CHECKLOOP; if (DoMethodA(o, (Msg)&method) == 0) /* avoid loops */ { struct TagItem *clonetags; if ((clonetags = CloneTagItems(msg->opu_AttrList))) { struct opUpdate opu = *msg; Object *member, *objstate; opu.MethodID = OM_UPDATE; /* not OM_NOTIFY! */ opu.opu_AttrList = clonetags; method = ICM_SETLOOP; DoMethodA(o, (Msg)&method); objstate = (Object *)data->memberlist.mlh_Head; while((member = NextObject(&objstate))) { DoMethodA(member, (Msg)&opu); /* in case the member object poked around in the taglist: */ RefreshTagItemClones(clonetags, msg->opu_AttrList); } method = ICM_CLEARLOOP; DoMethodA(o, (Msg)&method); FreeTagItems(clonetags); } } /* if (DoMethod(o, ICM_CHECKLOOP) == 0) */ } /* if (!IsListEmpty(&data->memberlist)) */ /* modelclass is a superclass of icclass so not only the members are targets, * but possibly also the modelclass object itself could have an ICA_Target. * This is handled by the superclass */ return DoSuperMethodA(cl, o, (Msg)msg); }
ULONG NEW_Gadget(piClass *cl,piObject *o,struct piSet *msg) { piObject *obj; struct Node_Gadget *ng; struct GadToolsData *gtd; ULONG size=0; if(GetTagData(GAOBJ_Type,GTYPE_GADTOOLS,msg->Tags)==GTYPE_GADTOOLS) size=sizeof(struct GadToolsData); if(obj=MyAllocVec(sizeof(piObject)+cl->Size+size,MEMF_PUBLIC|MEMF_CLEAR)) { ng=(struct Node_Gadget *)OBJECT_DATA(obj); obj->ln_Name=ng->ng_Label; ng->ng_NumTags=GetTagData(GAOBJ_NumTags,1,msg->Tags); ng->ng_NumOwnTags=GetTagData(GAOBJ_NumOwnTags,1,msg->Tags); if(ng->ng_Tags=AllocTagItems(ng->ng_NumTags)) { if(ng->ng_OwnTags=AllocTagItems(ng->ng_NumOwnTags)) { switch(GetTagData(GAOBJLIST_Tags,2,msg->Tags)) { case 0: ng->ng_EditList.List=(struct List **)&(ng->ng_Tags[GetTagData(GAOBJLIST_List,0,msg->Tags)].ti_Data); break; case 1: ng->ng_EditList.List=(struct List **)&(ng->ng_OwnTags[GetTagData(GAOBJLIST_List,0,msg->Tags)].ti_Data); break; case 2: ng->ng_EditList.List=NULL; break; } ng->ng_EditList.Active=(ULONG *)&(ng->ng_Tags[GetTagData(GAOBJLIST_Active,0,msg->Tags)].ti_Data); ng->ng_TagTypes=(UBYTE *)GetTagData(GAOBJ_TagTypes,0,msg->Tags); ng->ng_OwnTagTypes=(UBYTE *)GetTagData(GAOBJ_OwnTagTypes,0,msg->Tags); ng->ng_PlugInID=GetTagData(GAOBJ_ID,0,msg->Tags); ng->ng_Type=GetTagData(GAOBJ_Type,GTYPE_GADTOOLS,msg->Tags); ng->ng_Pages=(struct Page *)GetTagData(OBJ_Properties,NULL,msg->Tags); ng->ng_Gadget=NULL; if(ng->ng_Type==GTYPE_GADTOOLS) { gtd=(struct GadToolsData *)GadgetData(ng); gtd->g_Kind=BUTTON_KIND; gtd->g_Flags=PLACETEXT_LEFT; } return (ULONG) obj; // FreeTagItems(ng->ng_OwnTags); } FreeTagItems(ng->ng_Tags); } MyFreeVec(obj); } return NULL; }
static Object *bitmap_new(Class *cl, Object *obj, struct pRoot_New *msg) { struct TagItem tags[] = { {aHidd_BitMap_AllocBuffer, FALSE }, {TAG_MORE , (IPTR) NULL} }; struct HIDDBitMapAmigaIntuiData *data; struct TagItem *tag, *tstate, *newTagList; BOOL ok = FALSE; struct pRoot_New new_msg; struct pHidd_BitMap_PrivateSet private_set_msg; ULONG width, height, depth, format; BOOL displayable; EnterFunc(bug("BitMapAmigaIntui::New()\n")); new_msg.mID = GetMethodID(IID_Root, moRoot_New); private_set_msg.mID = GetMethodID(IID_Hidd_BitMap, moHidd_BitMap_PrivateSet); displayable = (BOOL) GetTagData(aHidd_BitMap_Displayable, 0, msg->attrList); if(!displayable) { /* let the superclass do all work */ obj = (Object *) DoSuperMethod(cl, obj, (Msg) msg); if(obj) ok = TRUE; } else { /* aHidd_BitMap_AllocBuffer and aHidd_BitMap_Displayable must be FALSE. To make this easy first a copy of the taglist is created. In the new list Hidd_BitMap_Displayable is set to FALSE. If the taglist contains a "aHidd_BitMap_AllocBuffer" tag then ti_Data is set to FALSE else tags(see above) is connected with the new list. NOTE: If msg.attrList contains more than one "aHidd_BitMap_AllocBuffer" we have a problem. */ newTagList = CloneTagItems(msg->attrList); if(newTagList) { tag = FindTagItem(aHidd_BitMap_Displayable, newTagList); if(tag) { tag->ti_Data = FALSE; } tag = FindTagItem(aHidd_BitMap_AllocBuffer, newTagList); if(tag) { tag->ti_Data = FALSE; new_msg.attrList = newTagList; } else { tags[1].ti_Data = (IPTR) newTagList; new_msg.attrList = tags; } obj = (Object *) DoSuperMethod(cl, obj, (Msg) &new_msg); FreeTagItems(newTagList); } if(obj) { data = INST_DATA(cl, obj); /* clear all data and set some default values */ memset(data, 0, sizeof(struct HIDDBitMapAmigaIntuiData)); GetAttr(obj, aHidd_BitMap_Width, &width); GetAttr(obj, aHidd_BitMap_Height, &height); GetAttr(obj, aHidd_BitMap_Depth, &depth); GetAttr(obj, aHidd_BitMap_Format, &format); if(format == vHIDD_BitMap_Format_Planar) { /* only displayable support for planar format */ struct TagItem tags[] = { {SA_Left , 0}, {SA_Top , 0}, {SA_Width , width}, {SA_Height , height}, {SA_Depth , depth}, {TAG_SKIP , 1}, /* Use SA_DisplayID only wenn a display mode */ {SA_DisplayID, 0}, /* is specified */ {SA_Title , (ULONG) "AROS graphics hidd"}, {SA_Type , CUSTOMSCREEN}, /* Will be use later */ /* SA_Quiet , TRUE, */ /* SA_BitMap , 0 On V37 double buffering could only implemented with a custom bitmap */ {TAG_DONE, 0} }; data->screen = OpenScreenTagList(NULL, tags); if(data->screen) { struct TagItem set[] = { {aHidd_BitMap_BaseAddress, (IPTR) &data->screen->RastPort.BitMap->Planes[0]}, {aHidd_BitMap_Format , vHIDD_BitMap_Format_Planar}, {aHidd_BitMap_Displayable, TRUE }, {aHidd_BitMap_BytesPerRow, data->screen->RastPort.BitMap->BytesPerRow}, {TAG_END , 0 } }; private_set_msg.attrList = set; DoSuperMethod(cl, obj, (Msg) &private_set_msg); ok = TRUE; } /* if(data->screen) */ } /* if(format == vHIDD_BitMap_Format_Planar) */ } /* if(obj) */ } /* if(!displayable) */ /* free all on error */ if(ok == FALSE) { if(obj) DisposeObject(obj); obj = NULL; } ReturnPtr("BitMapAmigaIntui::New", Object *, obj); }