コード例 #1
0
ファイル: cmmjl_osc.c プロジェクト: CNMAT/CNMAT-Externs
void cmmjl_osc_sendMsg(void *x, t_symbol *msg, int argc, t_atom *argv){
	t_linklist *ll = cmmjl_obj_osc_address_methods_get(x);
	t_symbol *m = gensym(basename(msg->s_name));
	char *osc_address;
	int i;
	method func;
	void *r;

	if(msg == ps_OSCTimeTag){
		return;
	}
	if(!ll){
		return;
	}
	osc_address = linklist_getindex(ll, 0);
	for(i = 0; i < linklist_getsize(ll); i++){
		if(!osc_address){
			post("no OSC address--breaking");
			break;
		}
		if(!cmmjl_osc_match(x, msg->s_name, osc_address)){
			func = zgetfn((t_object *)x, m);
			if(func){
				r = typedmess(x, m, argc, argv);
				//return;
			}
		}else{
		}
		linklist_next(ll, osc_address, (void **)&osc_address);
	}
	CMMJL_ERROR(x, CMMJL_ENOFUNC, "couldn't send message %s to object", m->s_name);
}
コード例 #2
0
ファイル: array.c プロジェクト: CNMAT/CNMAT-Externs
void ar_swap_keys(t_ar *x, t_symbol *msg, long argc, t_atom *argv){
	if(argc != 2){
		error("hashtab: swap_keys requires 2 arguments, not %d", argc);
		return;
	}
	t_linklist *ll;
	if(!(ll = (t_linklist *)x->iname_ll->s_thing)){
		return;
	}
	t_symbol *key1 = ar_encode_key(argv);
	t_symbol *key2 = ar_encode_key(argv + 1);
	t_symbol *test_key = (t_symbol *)linklist_getindex(ll, 0);
	int l1 = -1;
	int l2 = -1;
	int i = 0;
	while((l1 == -1 || l2 == -1) && i < linklist_getsize(ll)){
		if(test_key == key1){
			l1 = i;
		}
		if(test_key == key2){
			l2 = i;
		}
		i++;
		linklist_next(ll, (void *)test_key, (void **)(&test_key));
	}
	// this function will check to make sure that l1 and l2 are both greater than 0
	ar_swap_indices(x, l1, l2);
}
コード例 #3
0
void paramui_menu_do(t_paramui *x, t_object *patcherview, t_pt px, long modifiers)
{
	t_jpopupmenu 		*p;
	t_symobject			*item;
	long				size, i;
	int 				selectedId;
	t_jfont 			*font;
	int					coord_x=0, coord_y=0;
	t_pt				pt;

	jbox_set_mousedragdelta((t_object *)x, 0);
	p = jpopupmenu_create();

	font = jfont_create(JAMOMA_MENU_FONT,
						JGRAPHICS_FONT_SLANT_NORMAL,
						JGRAPHICS_FONT_WEIGHT_NORMAL,
						JAMOMA_MENU_FONTSIZE);
	jpopupmenu_setfont(p, font);
	jfont_destroy(font);
	size = linklist_getsize(x->menu_items);
	for(i=0; i<size; i++){
		item = (t_symobject *)linklist_getindex(x->menu_items, i);
		if(!item->sym || (item->sym->s_name[0] == '\0') || item->sym->s_name[0] == '-')//{
			jpopupmenu_addseperator(p);
		else
			jpopupmenu_additem(p, i+1, item->sym->s_name, NULL, 0, item->flags, NULL);
	}

	object_method(patcherview, gensym("canvastoscreen"), 0.0, 0.0, &coord_x, &coord_y);	
	coord_x += x->box.b_patching_rect.x;
	coord_y += x->box.b_patching_rect.y;
	pt.x = coord_x;
	pt.y = coord_y;
	selectedId = jpopupmenu_popup_nearbox(p, (t_object*)x, patcherview, x->menu_selection+1); 
	if(selectedId){
		x->menu_selection = selectedId -1;
		qelem_set(x->menu_qelem);
	}

	jpopupmenu_destroy(p);
}