static void plustot_env_source(t_plustot_env *x, t_symbol *s) { if (s && s != &s_) plustot_env_evalfile(x, s); else hammerpanel_open(x->x_filehandle, 0); }
/* CHECKED symbol arg ok */ static void funbuff_read(t_funbuff *x, t_symbol *s) { if (s && s != &s_) funbuff_doread(x, s); else hammerpanel_open(x->x_filehandle, 0); }
static void mtr_read(t_mtr *x, t_symbol *s) { if (s && s != &s_) mtr_doread(x, 0, s); else /* CHECKED no default */ hammerpanel_open(x->x_filehandle, 0); }
static void mtrack_read(t_mtrack *tp, t_symbol *s) { if (s && s != &s_) mtr_doread(tp->tr_owner, tp, s); else /* CHECKED no default */ hammerpanel_open(tp->tr_filehandle, 0); }
static void hammer_doimport(t_hammer *x, t_symbol *fn) { if (fn && fn != &s_) { t_symbol *dir = hammerpanel_getopendir(x->x_filehandle); int result = import_max(fn->s_name, (dir && dir != &s_ ? dir->s_name : "")); outlet_float(((t_object *)x)->ob_outlet, (t_float)result); } else hammerpanel_open(x->x_filehandle, 0); }
static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname) { char path[MAXPDSTRING]; FILE *fp; /* FIXME use open_via_path() */ if (x->x_glist) canvas_makefilename(x->x_glist, fname->s_name, path, MAXPDSTRING); else { strncpy(path, fname->s_name, MAXPDSTRING); path[MAXPDSTRING-1] = 0; } /* CHECKED no global message */ if (fp = sys_fopen(path, "r")) { t_mtrack *tp = 0; char linebuf[MTR_FILEBUFSIZE]; t_binbuf *bb = binbuf_new(); while (fgets(linebuf, MTR_FILEBUFSIZE, fp)) { char *line = linebuf; int linelen; while (*line && (*line == ' ' || *line == '\t')) line++; if (linelen = strlen(line)) { if (tp) { if (!strncmp(line, "end;", 4)) { post("ok"); tp = 0; } else { int ac; binbuf_text(bb, line, linelen); if (ac = binbuf_getnatom(bb)) { t_atom *ap = binbuf_getvec(bb); if (!binbuf_getnatom(tp->tr_binbuf)) { if (ap->a_type != A_FLOAT) { t_atom at; SETFLOAT(&at, 0.); binbuf_add(tp->tr_binbuf, 1, &at); } else if (ap->a_w.w_float < 0.) ap->a_w.w_float = 0.; } binbuf_add(tp->tr_binbuf, ac, ap); } } } else if (!strncmp(line, "track ", 6)) { int id = strtol(line + 6, 0, 10); startpost("Track %d... ", id); if (id < 1 || id > x->x_ntracks) post("no such track"); /* LATER rethink */ else if (target) { if (id == target->tr_id) tp = target; post("skipped"); /* LATER rethink */ } else tp = x->x_tracks[id - 1]; if (tp) { binbuf_clear(tp->tr_binbuf); } } } } fclose(fp); binbuf_free(bb); } else { /* CHECKED no complaint, open dialog not presented... */ /* LATER rethink */ hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle, 0); } }