short posit_enumquery(t_patcher *p, t_posit *x) { t_object *jb; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; jb = jpatcher_get_firstobject(p); // get the first BOX in the object list patchername = jpatcher_get_name(p); while(jb) { // iterate through patcher classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname && scriptingname == x->p_query[0].a_w.w_sym) { jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); x->p_state = 1; break; } jb = jbox_get_nextobject(jb); // iterate } return 0; }
short posit_enumnames(t_patcher *p, t_posit *x) { t_object *jb; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; patchername = jpatcher_get_name(p); if(patchername && patchername != ps_nothing) { // post("patchername is %s", patchername->s_name jb = jpatcher_get_firstobject(p); // get the first BOX in the object list while(jb) { // iterate through patcher classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname && scriptingname != ps_nothing) { jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); } jb = jbox_get_nextobject(jb); // iterate } } return 0; }
void posit_getinfo(t_posit *x) { t_object *jp; t_object *jb; t_object *pbox; t_rect jr; t_symbol *scriptingname = ps_none; t_symbol *patchername = ps_none; t_symbol *patcherscriptingname = ps_none; t_max_err err; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; err = object_obex_lookup(x, gensym("#P"), (t_object **)&jp); // get the object's parent patcher if (err != MAX_ERR_NONE) return; err = object_obex_lookup(x, gensym("#B"), (t_object **)&jb); // get the object's wrapping box if (err != MAX_ERR_NONE) return; patchername = jpatcher_get_name(jp); classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname == NULL || scriptingname == ps_nothing) { scriptingname = ps_none; } pbox = jpatcher_get_box(jp); if(pbox) patcherscriptingname = jbox_get_varname(pbox); // scripting name if (patcherscriptingname == NULL || patcherscriptingname == ps_nothing) { patcherscriptingname = ps_none; } jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name atom_setsym(outlist+7, patcherscriptingname); outlet_list(x->p_outlet,0L,8,outlist); outlet_bang(x->p_outlet2); //bang to notify of end of dump }
short posit_enumbuffers(t_patcher *p, t_posit *x) { t_buffer *bufob; t_object *jb; t_object *o; t_rect jr; t_symbol *scriptingname; t_symbol *buffername; t_symbol *patchername; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; jb = jpatcher_get_firstobject(p); // get the first BOX in the object list patchername = jpatcher_get_name(p); while(jb) { // iterate through patcher x->p_flag = 0; classname = jbox_get_maxclass(jb); // class name if(classname == ps_buff){ o = jbox_get_object(jb); bufob = (t_buffer *)o; buffername = (t_symbol *)bufob->b_name; scriptingname = jbox_get_varname(jb); // scripting name if (!scriptingname || scriptingname == ps_nothing) { scriptingname = ps_none; } jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, buffername); // scripting name atom_setsym(outlist+2, patchername); // patcher name atom_setsym(outlist+3, scriptingname); atom_setlong(outlist+4, (long)((long)jr.x)); atom_setlong(outlist+5, (long)((long)jr.y)); atom_setlong(outlist+6, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+7, (long)((long)jr.y + (long)jr.height)); outlet_list(x->p_outlet,0L,8,outlist); x->p_flag = 1; } jb = jbox_get_nextobject(jb); // iterate } return 0; }
void posit_boxes(t_posit *x) // ok: done { t_object *jp; t_object *jb; t_object *mybox; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_max_err err; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; err = object_obex_lookup(x, gensym("#P"), (t_object **)&jp); // get the object's parent patcher if (err != MAX_ERR_NONE) return; err = object_obex_lookup(x, gensym("#B"), (t_object **)&mybox); // get the object's wrapping box if (err != MAX_ERR_NONE) return; jb = jpatcher_get_firstobject(jp); // get the first BOX in the object list patchername = jpatcher_get_name(jp); while(jb) { // iterate through patcher classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname == NULL || scriptingname == ps_nothing) { scriptingname = ps_none; } jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); jb = jbox_get_nextobject(jb); // iterate } outlet_bang(x->p_outlet2); //bang to notify of end of dump }
void UnpackAttachToPatchlinesForPatcher(UnpackPtr self, ObjectPtr patcher) { ObjectPtr patchline = object_attr_getobj(patcher, _sym_firstline); ObjectPtr box = jpatcher_get_firstobject(patcher); while (patchline) { object_attach_byptr_register(self, patchline, _sym_nobox); patchline = object_attr_getobj(patchline, _sym_nextline); } while (box) { SymbolPtr classname = jbox_get_maxclass(box); if (classname == _sym_jpatcher) { ObjectPtr subpatcher = jbox_get_object(box); UnpackAttachToPatchlinesForPatcher(self, subpatcher); } box = jbox_get_nextobject(box); } }
void OutAttachToPatchlinesForPatcher(OutPtr self, t_object* patcher) { t_object* patchline = object_attr_getobj(patcher, _sym_firstline); t_object* box = jpatcher_get_firstobject(patcher); while (patchline) { object_attach_byptr_register(self, patchline, _sym_nobox); patchline = object_attr_getobj(patchline, _sym_nextline); } while (box) { t_symbol *classname = jbox_get_maxclass(box); if (classname == _sym_jpatcher) { t_object* subpatcher = jbox_get_object(box); OutAttachToPatchlinesForPatcher(self, subpatcher); } box = jbox_get_nextobject(box); } }
short posit_enumcolls(t_patcher *p, t_posit *x) { t_coll *collob; t_object *jb; t_object *o; t_rect jr; t_symbol *scriptingname; t_symbol *collname; t_symbol *patchername; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; jb = jpatcher_get_firstobject(p); // get the first BOX in the object list patchername = jpatcher_get_name(p); while(jb) { // iterate through patcher x->p_flag = 0; classname = jbox_get_maxclass(jb); // class name if(classname == ps_coll){ o = jbox_get_object(jb); collob = (t_coll *)o; collname = (t_symbol *)collob->c_x->c_sym; scriptingname = jbox_get_varname(jb); // scripting name if (!scriptingname || scriptingname == ps_nothing) { scriptingname = ps_none; } jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, collname); // scripting name atom_setsym(outlist+2, patchername); // patcher name atom_setsym(outlist+3, scriptingname); atom_setlong(outlist+4, (long)((long)jr.x)); atom_setlong(outlist+5, (long)((long)jr.y)); atom_setlong(outlist+6, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+7, (long)((long)jr.y + (long)jr.height)); outlet_list(x->p_outlet,0L,8,outlist); x->p_flag = 1; } jb = jbox_get_nextobject(jb); // iterate } /* for (b = p->p_box; b; b = b->b_next) { if(b->b_firstin && (ob_sym(b->b_firstin) == ps_coll)) { x->p_patcher2 = b->b_patcher; strcpy(name, x->p_patcher2->p_wind->w_name); ptr = name; collob = (t_coll *)b->b_firstin; outlist[1].a_type = A_SYM; outlist[1].a_w.w_sym = collob->c_x->c_sym; SETSYM(outlist+2, gensym(ptr)); SETSYM(outlist+0, ps_coll); if(outlist[1].a_w.w_sym != ps_nothing){ outlet_list(x->p_outlet, 0L, 3, outlist); } } }*/ return 0; }
void posit_classquery(t_posit *x, t_symbol *s, short ac, t_atom *av) { t_object *jp; t_object *jb; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_max_err err; t_symbol *classname; t_atom *outlist; t_symbol *classquery = ps_nothing; outlist = x->p_outlist; x->p_flag = 0; if (ac > 0) { switch (av[0].a_type) { case A_FLOAT: return; case A_LONG: return; case A_SYM: classquery = (t_symbol*)av[0].a_w.w_sym; break; } err = object_obex_lookup(x, gensym("#P"), (t_object **)&jp); // get the object's parent patcher if (err != MAX_ERR_NONE) return; jb = jpatcher_get_firstobject(jp); // get the first BOX in the object list patchername = jpatcher_get_name(jp); while(jb) { // iterate through patcher x->p_flag = 0; classname = jbox_get_maxclass(jb); // class name if(classname == classquery){ scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname && scriptingname != ps_nothing) { ; }else{ scriptingname = ps_none; } jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); x->p_flag = 1; } jb = jbox_get_nextobject(jb); // iterate } if(!x->p_flag){ outlet_int(x->p_outlet3,0); }else if(x->p_flag){ outlet_bang(x->p_outlet2); //bang to notify of end of dump outlet_int(x->p_outlet3,1); } } }
void posit_rename(t_posit *x, t_symbol *s, short ac, t_atom *av) // ok done { t_object *jp; t_object *jb; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_max_err err; t_symbol *classname; t_atom *outlist; t_symbol *oldname = ps_nothing; t_symbol *newname = ps_nothing; short i; outlist = x->p_outlist; if (ac > 1){ for (i=0; i < 2; i++) { switch (av[i].a_type) { case A_FLOAT: return; case A_LONG: return; case A_SYM: if(i==0){ oldname = (t_symbol*)av[0].a_w.w_sym; } else if(i==1){ newname = (t_symbol*)av[1].a_w.w_sym; } break; } } err = object_obex_lookup(x, gensym("#P"), (t_object **)&jp); // get the object's parent patcher if (err != MAX_ERR_NONE) return; jb = jpatcher_get_firstobject(jp); // get the first BOX in the object list patchername = jpatcher_get_name(jp); while(jb) { // iterate through patcher classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname && scriptingname == oldname) { jbox_set_varname(jb, newname); scriptingname = jbox_get_varname(jb); // scripting name jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); break; } jb = jbox_get_nextobject(jb); // iterate } } outlet_bang(x->p_outlet2); //bang to notify of end of dump }