widget* spawn_voxobj(char* filename) { // widget *w = widget_window_new(100, 100, filename); WF_OBJ *m = wf_load(filename); extern WF_OBJ *vobj; if(vobj)wf_free(vobj); vobj = m; voxel_open(); // w->data2 = m; // w->draw = widget_window_obj_draw; // w->free = widget_window_obj_free; // w->onclick = widget_window_obj_onclick; // float3 *p = malloc(sizeof(float3)); // p->x = p->y = p->z = 0; // w->data3 = p; // widget_add(w); return NULL; }
/* * read all of the data from a SpiceStream and store it in the WaveFile * structure. */ WaveFile *wf_finish_read(SpiceStream *ss) { WaveFile *wf; int rc; double ival; double *dvals; WvTable *wt; int state; double *spar = NULL; wf = g_new0(WaveFile, 1); wf->ss = ss; wf->tables = g_ptr_array_new(); dvals = g_new(double, ss->ncols); state = 0; do { wt = wf_read_table(ss, wf, &state, &ival, dvals); if(wt) { ss_msg(DBG, "wf_finish_read", "table with %d rows; state=%d", wt->nvalues, state); wt->swindex = wf->wf_ntables; g_ptr_array_add(wf->tables, wt); if(!wt->name) { char tmp[128]; sprintf(tmp, "tbl%d", wf->wf_ntables); wt->name = g_strdup(tmp); } } else { ss_msg(DBG, "wf_finish_read", "NULL table; state=%d", state); } } while(state > 0); g_free(dvals); g_free(spar); ss_close(ss); if(state < 0) { wf_free(wf); return NULL; } else { return wf; } }
void widget_window_obj_free(widget *w) { WF_OBJ *m = w->data2; wf_free(m); }