static t_scriptlet *masterwidget_cmnthook(t_pd *caller, char *rc, char sel, char *buf) { t_masterwidget *mw = masterwidget; if (!*buf) return (SCRIPTLET_UNLOCK); if (sel == '>') { t_symbol *typekey; t_widgettype *typeval; char *cls = scriptlet_nextword(buf); char *req = (cls ? scriptlet_nextword(cls) : 0); mw->mw_parsedtype = 0; if (!cls) cls = buf; typekey = dict_key(mw->mw_typemap, buf); typeval = (t_widgettype *)dict_firstvalue(mw->mw_typemap, typekey, 0); if (caller == (t_pd *)mw) { /* setup.wid or built-in defaults */ if (typeval) { /* LATER may need revisiting, when/if we accept explicit 'redefine' requests for internal types */ loud_warning((t_pd *)mw, 0, "redefinition of '%s'\ in \"%s.wid\" file, ignored", buf, rc); return (SCRIPTLET_LOCK); } } else { /* <type>.wid */ if (caller != (t_pd *)typeval)
static t_widgettype *widgettype_new(t_masterwidget *mw, char *typ, char *cls, char *req, t_glist *glist) { t_widgettype *wt = (t_widgettype *)pd_new(widgettype_class); wt->wt_glist = glist; wt->wt_typekey = dict_key(mw->mw_typemap, typ); widgettype_map(wt, cls, req); wt->wt_isinternal = 0; wt->wt_options = props_new(0, "option", "-", 0, 0); wt->wt_handlers = props_new(0, "handler", "@", wt->wt_options, 0); wt->wt_arguments = props_new(0, "argument", "#", wt->wt_options, 0); wt->wt_auxscript = scriptlet_new((t_pd *)wt, mw->mw_target, mw->mw_target, 0, 0, widgettype_cvhook); wt->wt_scripts = widgethandlers_new(wt->wt_auxscript); dict_bind(mw->mw_typemap, (t_pd *)wt, wt->wt_typekey); return (wt); }
/* adapted m_pd_setup() from m_pd.c */ static void dict_bindlist_setup(t_dict *x) { x->d_bindlist_class = class_new(dict_key(x, "bindlist"), 0, 0, sizeof(t_dict_bindlist), CLASS_PD, 0); class_addanything(x->d_bindlist_class, dict_bindlist_anything); }
t_pd *dict_xvalue(t_dict *x, t_symbol *s) { if (s && s != &s_) return (dict_value(x, dict_key(x, s->s_name))); return (0); }