void hammerembed_save(t_gobj *master, t_binbuf *bb) { t_hammerfile *f = hammerfile_getproxy((t_pd *)master); t_text *t = (t_text *)master; binbuf_addv(bb, "ssii", &s__X, gensym("obj"), (int)t->te_xpix, (int)t->te_ypix); binbuf_addbinbuf(bb, t->te_binbuf); binbuf_addsemi(bb); if (f && f->f_embedfn) (*f->f_embedfn)(f->f_master, bb, ps__C); binbuf_addv(bb, "ss;", ps__C, gensym("restore")); }
void array_define_save(t_gobj *z, t_binbuf *bb) { t_glist *x = (t_glist *)z; t_glist *gl = (x->gl_list ? pd_checkglist(&x->gl_list->g_pd) : 0); binbuf_addv(bb, "ssff", &s__X, gensym("obj"), (float)x->gl_obj.te_xpix, (float)x->gl_obj.te_ypix); binbuf_addbinbuf(bb, x->gl_obj.ob_binbuf); binbuf_addsemi(bb); garray_savecontentsto((t_garray *)gl->gl_list, bb); obj_saveformat(&x->gl_obj, bb); }
static void preset_save(t_presetobj *x, t_binbuf *d) { binbuf_addv(d, (char *)"ss", cream_sym_atpreset, cream_sym_left_bracket); for(int i = 0; i < CREAM_MAXITEMS; i++) { if(binbuf_getnatom(x->f_binbuf[i])) { binbuf_addv(d, (char *)"sf", cream_sym_atindex, (float)i); binbuf_addbinbuf(d, x->f_binbuf[i]); } } binbuf_addv(d, (char *)"s", cream_sym_right_bracket); }
void eobj_dosave(t_eobj* x, t_binbuf *b) { t_binbuf* d; t_eclass* c = eobj_getclass(x); if(c && b) { binbuf_addv(b, (char *)"ssii", &s__X, s_obj, (t_int)x->o_obj.te_xpix, (t_int)x->o_obj.te_ypix); d = x->o_obj.te_binbuf; if(d) { binbuf_addbinbuf(b, d); } if(c->c_widget.w_save != NULL) { c->c_widget.w_save(x, b); } binbuf_addv(b, (char *)";"); } }
void eobj_save(t_gobj* x, t_binbuf *b) { int i, state; int argc = 0; t_atom* argv = NULL; t_binbuf* d; t_object* z = (t_object *)x; t_ebox* y = (t_ebox *)z; t_eclass* c = eobj_getclass(x); char buffer[MAXPDSTRING]; if(x && b) { if(eobj_isbox(x)) { if(c && b) { state = canvas_suspend_dsp(); binbuf_addv(b, (char *)"ssiis", &s__X, s_cream_obj, (t_int)z->te_xpix, (t_int)z->te_ypix, eobj_getclassname(x)); for(i = 0; i < c->c_nattr; i++) { if(c->c_attr[i] && c->c_attr[i]->save && c->c_attr[i]->name) { eobj_attr_getvalueof(x, c->c_attr[i]->name, &argc, &argv); if(argc && argv) { if(!(argc == 1 && atom_gettype(argv) == A_SYMBOL && !is_valid_symbol(atom_getsymbol(argv)))) { snprintf(buffer, MAXPDSTRING, "@%s", c->c_attr[i]->name->s_name); binbuf_append_attribute(b, gensym(buffer), argc, argv); } argc = 0; free(argv); argv = NULL; } } } argv = (t_atom *)malloc(3 * sizeof(t_atom)); if(argv) { for(i = 0; i < y->b_nparams; i++) { if(y->b_params[i]) { snprintf(buffer, MAXPDSTRING, "@param%i", i); atom_setsym(argv, y->b_params[i]->p_name); atom_setsym(argv+1, y->b_params[i]->p_label); atom_setfloat(argv+2, y->b_params[i]->p_index); binbuf_append_attribute(b, gensym(buffer), 3, argv); } } } if(c->c_widget.w_save != NULL) { c->c_widget.w_save(x, b); } binbuf_addv(b, (char *)";"); canvas_resume_dsp(state); } } else { binbuf_addv(b, (char *)"ssii", &s__X, s_cream_obj, (t_int)z->te_xpix, (t_int)z->te_ypix); d = z->te_binbuf; if(d) { binbuf_addbinbuf(b, d); } if(c->c_widget.w_save != NULL) { c->c_widget.w_save(x, b); } binbuf_addv(b, (char *)";"); } } }