Ejemplo n.º 1
0
static void plane_float(t_plane *x, float f)
{
    ebox_parameter_setvalue((t_ebox *)x, 1, f, eobj_getproxy(x) + 1);
    plane_output(x);
    ebox_invalidate_layer((t_ebox *)x, cream_sym_points_layer);
    ebox_redraw((t_ebox *)x);
}
Ejemplo n.º 2
0
void plane_mousedrag(t_plane *x, t_object *patcherview, t_pt pt, long modifiers)
{
    t_atom argv[2];
    pt.x -= (x->f_size + 2);
    pt.y += (x->f_size - 2);
    atom_setfloat(argv, (pt.x + x->f_boundaries.x * x->f_ratio.x) / x->f_ratio.x);
    atom_setfloat(argv+1, (pt.y - (x->j_box.b_rect.height + x->f_boundaries.y * x->f_ratio.y)) / -x->f_ratio.y);
    plane_set(x, NULL, 2, argv);
    plane_output(x);
}
Ejemplo n.º 3
0
static void plane_list(t_plane *x, t_symbol* s, int argc, t_atom *argv)
{
    if(argc > 0 && atom_gettype(argv) == A_FLOAT)
    {
        ebox_parameter_setvalue((t_ebox *)x, 1, atom_getfloat(argv), 1);
    }
    if(argc > 1 && atom_gettype(argv+1) == A_FLOAT)
    {
        ebox_parameter_setvalue((t_ebox *)x, 1, atom_getfloat(argv+1), 1);
    }
    plane_output(x);
    ebox_invalidate_layer((t_ebox *)x, cream_sym_points_layer);
    ebox_redraw((t_ebox *)x);
}
Ejemplo n.º 4
0
static void plane_mousedrag(t_plane *x, t_object *patcherview, t_pt pt, long modifiers)
{
    t_rect rect;
    ebox_get_rect_for_view((t_ebox *)x, &rect);
    const float minx = ebox_parameter_getmin((t_ebox *)x, 1);
    const float maxx = ebox_parameter_getmax((t_ebox *)x, 1);
    const float miny = ebox_parameter_getmin((t_ebox *)x, 2);
    const float maxy = ebox_parameter_getmax((t_ebox *)x, 2);
    const float valx = plane_getvalue(&rect, pt.x, minx, maxx, x->f_size);
    const float valy = plane_getvalue(&rect, (rect.height - pt.y), miny, maxy, x->f_size);
    ebox_parameter_setvalue((t_ebox *)x, 1, valx, 1);
    ebox_parameter_setvalue((t_ebox *)x, 2, valy, 1);
    
    plane_output(x);
    ebox_invalidate_layer((t_ebox *)x, cream_sym_points_layer);
    ebox_redraw((t_ebox *)x);
}
Ejemplo n.º 5
0
static t_pd_err plane_notify(t_plane *x, t_symbol *s, t_symbol *msg, void *sender, void *data)
{
	if(msg == cream_sym_attr_modified)
	{
		if(s == cream_sym_bgcolor || s == cream_sym_bdcolor || s == cream_sym_ptcolor || s == cream_sym_ptsize)
		{
			ebox_invalidate_layer((t_ebox *)x, cream_sym_points_layer);
		}
	}
    else if(msg == cream_sym_value_changed)
    {
        plane_output(x);
        ebox_invalidate_layer((t_ebox *)x, cream_sym_points_layer);
        ebox_redraw((t_ebox *)x);
    }
	return 0;
}
Ejemplo n.º 6
0
t_pd_err plane_bound_set(t_plane *x, t_object *attr, long ac, t_atom *av)
{
	t_atom argv[2];
    
    if(ac && av)
    {
        if(ac >= 1)
            x->f_boundaries.x = atom_getfloat(av);
        if(ac >= 2)
            x->f_boundaries.y = atom_getfloat(av+1);
        if(ac >= 3)
            x->f_boundaries.width = atom_getfloat(av+2);
        if(ac >= 4)
            x->f_boundaries.height = atom_getfloat(av+3);
        
        // Boundaries changed -> recompute the point position !
        atom_setfloat(argv, x->f_position.x);
        atom_setfloat(argv+1, x->f_position.y);
        plane_set(x, NULL, 2, argv);
        plane_output(x);
    }
    return 0;
}
Ejemplo n.º 7
0
void plane_list(t_plane *x, t_symbol *s, long ac, t_atom *av)
{
    plane_set(x, NULL, ac, av);
    plane_output(x);
}
Ejemplo n.º 8
0
static void plane_bang(t_plane *x)
{
    ebox_parameter_notify_changes((t_ebox *)x, 1);
    ebox_parameter_notify_changes((t_ebox *)x, 2);
    plane_output(x);
}