static IPTR mLampCleanup(struct IClass *cl,Object *obj,struct MUIP_Setup *msg) { struct lampData *data = INST_DATA(cl,obj); if(isFlagSet(data->flags, FLG_LampSetup)) { MUI_ReleasePen(muiRenderInfo(obj),data->enabled); MUI_ReleasePen(muiRenderInfo(obj),data->disabled); MUI_ReleasePen(muiRenderInfo(obj),data->detail); CLEAR_FLAG(data->flags, FLG_LampSetup); } return DoSuperMethodA(cl,obj,(APTR)msg); }
IPTR Pendisplay__MUIM_Cleanup(struct IClass *cl, Object *obj, struct MUIP_Cleanup *msg) { struct Pendisplay_DATA *data = INST_DATA(cl,obj); if (data->pen != -1) { MUI_ReleasePen(muiRenderInfo(obj), data->pen); data->pen = -1; } return DoSuperMethodA(cl, obj, (Msg)msg); }
IPTR Pendisplay__OM_SET(struct IClass *cl, Object *obj, struct opSet *msg) { struct Pendisplay_DATA *data; const struct TagItem *tags; struct TagItem *tag; BOOL newcol = FALSE; IPTR retval; data = INST_DATA(cl, obj); for (tags = msg->ops_AttrList; (tag = NextTagItem(&tags)); ) { switch (tag->ti_Tag) { case MUIA_Pendisplay_Reference: if (data->refobj) { DoMethod(data->refobj, MUIM_KillNotifyObj, MUIA_Pendisplay_Spec, (IPTR)obj); } data->refobj = (Object *)tag->ti_Data; if (data->refobj) { DoMethod(data->refobj, MUIM_Notify, MUIA_Pendisplay_Spec, MUIV_EveryTime, (IPTR)obj, 3, MUIM_Set, MUIA_Pendisplay_Spec, MUIV_TriggerValue); } newcol = TRUE; break; case MUIA_Pendisplay_RGBcolor: { struct MUI_RGBcolor *rgb = (struct MUI_RGBcolor *)tag->ti_Data; snprintf(data->penspec.ps_buf, sizeof(data->penspec.ps_buf), "%lc%08lx,%08lx,%08lx", (LONG)PST_RGB, rgb->red, rgb->green, rgb->blue); } newcol = TRUE; break; case MUIA_Pendisplay_Spec: if (tag->ti_Data) { data->penspec = *(struct MUI_PenSpec *)tag->ti_Data; newcol = TRUE; } break; } } retval = DoSuperMethodA(cl, obj, (Msg)msg); if (newcol && (_flags(obj) & MADF_SETUP)) { if (data->pen != -1) { MUI_ReleasePen(muiRenderInfo(obj), data->pen); data->pen = -1; } if (!data->refobj) { data->pen = MUI_ObtainPen(muiRenderInfo(obj), &data->penspec, 0); } MUI_Redraw(obj, MADF_DRAWUPDATE); } return retval; }