Ejemplo n.º 1
0
static t_pd_err tab_notify(t_tab *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_textcolor ||
                s == cream_sym_hocolor ||
                s == cream_sym_secolor ||
                s == cream_sym_orientation ||
                s == cream_sym_font)
        {
            ebox_invalidate_layer((t_ebox *)x, cream_sym_selection_layer);
            ebox_invalidate_layer((t_ebox *)x, cream_sym_text_layer);
            ebox_invalidate_layer((t_ebox *)x, cream_sym_background_layer);
        }
        else if(s == cream_sym_orientation ||
                s == cream_sym_items)
        {
            ebox_notify((t_ebox *)x, s_cream_size, cream_sym_attr_modified, NULL, NULL);
        }
    }
    else if(msg == cream_sym_value_changed)
    {
        tab_output(x);
        ebox_invalidate_layer((t_ebox *)x, cream_sym_background_layer);
        ebox_redraw((t_ebox *)x);
    }
    return 0;
}
Ejemplo n.º 2
0
static void tab_clear(t_tab *x)
{
    x->f_nitems = 0;
    ebox_parameter_setminmax((t_ebox *)x, 1, 0.f, 0.f);
    ebox_parameter_setnstep((t_ebox *)x, 1, 1);
    ebox_notify((t_ebox *)x, s_cream_size, cream_sym_attr_modified, NULL, NULL);
}
Ejemplo n.º 3
0
static void tab_append(t_tab *x, t_symbol *s, int argc, t_atom *argv)
{
    t_symbol* item = tab_gensym(NULL, argc, argv);
    if(x->f_nitems < CREAM_MAXITEMS - 1 && item)
    {
        x->f_items[x->f_nitems] = item;
        x->f_nitems++;
        ebox_parameter_setminmax((t_ebox *)x, 1, 0.f, (float)x->f_nitems - 1.f);
        ebox_parameter_setnstep((t_ebox *)x, 1, (int)x->f_nitems);
        ebox_notify((t_ebox *)x, s_cream_size, cream_sym_attr_modified, NULL, NULL);
    }
}
Ejemplo n.º 4
0
static void tab_delete(t_tab *x, float f)
{
    int i;
    const int index = (int)f;
    if(index >= 0 && index < x->f_nitems)
    {
        for(i = index; i < x->f_nitems - 1; i++)
            x->f_items[i] = x->f_items[i+1];
        x->f_nitems--;
        ebox_parameter_setminmax((t_ebox *)x, 1, 0.f, (float)x->f_nitems);
        ebox_parameter_setnstep((t_ebox *)x, 1, (int)x->f_nitems);
        ebox_notify((t_ebox *)x, s_cream_size, cream_sym_attr_modified, NULL, NULL);
    }
}
Ejemplo n.º 5
0
static void tab_insert(t_tab *x, t_symbol *s, int argc, t_atom *argv)
{
    int i, index;
    t_symbol* item;
    if(argc && argv && atom_gettype(argv) == A_FLOAT)
    {
        index   = (int)pd_clip(atom_getfloat(argv), 0.f, (float)x->f_nitems);
        item    = tab_gensym(NULL, argc-1, argv+1);
        if(item)
        {
            for(i = (int)x->f_nitems; i > index; i--)
            {
                x->f_items[i] = x->f_items[i-1];
            }
            x->f_items[index] = item;
            x->f_nitems++;
            ebox_parameter_setminmax((t_ebox *)x, 1, 0.f, (float)x->f_nitems - 1.f);
            ebox_parameter_setnstep((t_ebox *)x, 1, (int)x->f_nitems);
            ebox_notify((t_ebox *)x, s_cream_size, cream_sym_attr_modified, NULL, NULL);
        }
    }
}
Ejemplo n.º 6
0
t_max_err hoa_space_notify(t_hoa_space *x, t_symbol *s, t_symbol *msg, void *sender, void *data)
{
	if (msg == gensym("attr_modified"))
	{
        if(s == gensym("miccolor"))
        {
            jbox_invalidate_layer((t_object *)x, NULL, gensym("microphones_layer"));
        }
        else if(s == gensym("harmocolor"))
        {
            jbox_invalidate_layer((t_object *)x, NULL, gensym("microphones_layer"));
            jbox_invalidate_layer((t_object *)x, NULL, gensym("harmonics_layer"));
        }
        else if(s == gensym("circolor"))
        {
            jbox_invalidate_layer((t_object *)x, NULL, gensym("microphones_layer"));
            jbox_invalidate_layer((t_object *)x, NULL, gensym("harmonics_layer"));
            jbox_invalidate_layer((t_object *)x, NULL, gensym("background_layer"));
        }
        jbox_redraw((t_jbox *)x);
	}
	return ebox_notify((t_jbox *)x, s, msg, sender, data);
}