void dict_route_dictionary(t_dict_route *x, t_symbol *s) { t_dictionary *d = dictobj_findregistered_retain(s); if (!d) { object_error((t_object*)x, "unable to reference dictionary named %s", s); return; } if (proxy_getinlet((t_object*)x) == 0) { // left inlet : validate the input against the schema long validates = false; t_atom a; validates = dictobj_validate(x->schema_dict, d); atom_setsym(&a, s); if (validates) outlet_anything(x->outlet_dict, _sym_dictionary, 1, &a); else outlet_anything(x->outlet_nomatch, _sym_dictionary, 1, &a); } else { // right inlet : set the contents of the schema with a copy of the incoming dictionary if (d) { dictionary_clear(x->schema_dict); dictionary_clone_to_existing(d, x->schema_dict); } } dictobj_release(d); }
int com_dict_clear(char* arg) { dictionary_clear(); return 0; }
long tralala_mouseHitNote(t_tll *x, long m) { long i, n = 0; t_symbol *s = NULL; t_symbol *mark = NULL; t_symbol **keys = NULL; long position = TLL_X_TO_POSITION(x->cursor.x - 1.); long pitch = TLL_Y_TO_PITCH(x->cursor.y - 1.); long k = TLL_HIT_NONE; TLL_DATA_LOCK dictionary_deleteentry(x->status, TLL_SYM_ZONE); if (!(dictionary_getkeys(x->current, &n, &keys))) { // long argc; t_atom *argv = NULL; for (i = 0; i < n; i++) { t_symbol *key = (*(keys + i)); if (!(dictionary_getatoms(x->current, key, &argc, &argv))) { if ((atom_getsym(argv) == TLL_SYM_NOTE)) { long p = atom_getlong(argv + 2); long a = atom_getlong(argv + 1); long b = a + atom_getlong(argv + 4); if ((pitch == p) && (position >= a) && (position <= b)) { s = key; break; } } } } dictionary_freekeys(x->current, n, keys); // } if (s) { if (dictionary_hasentry(x->status, s)) { if (m & eShiftKey) { k = TLL_HIT_SWAP; } else { k = TLL_HIT_GRAB; } } else { k = TLL_HIT_PULL; } } if (!(m & eShiftKey) && ((k == TLL_HIT_NONE) || (k == TLL_HIT_PULL))) { dictionary_clear(x->status); } if (k == TLL_HIT_SWAP) { if(!(dictionary_getsym(x->status, TLL_SYM_MARK, &mark)) && (s == mark)) { dictionary_deleteentry(x->status, TLL_SYM_MARK); } dictionary_deleteentry(x->status, s); } else if (k == TLL_HIT_GRAB) { dictionary_appendsym(x->status, TLL_SYM_MARK, s); } else if (k == TLL_HIT_PULL) { dictionary_appendsym(x->status, TLL_SYM_MARK, s); dictionary_appendlong(x->status, s, TLL_SELECTED); } TLL_DATA_UNLOCK return k; }
void tralala_mouseUnselectAll(t_tll *x) { TLL_DATA_LOCK dictionary_clear(x->status); TLL_DATA_UNLOCK }