Exemplo n.º 1
0
static void preset_mousemove(t_presetobj *x, t_object *patcherview, t_pt pt, long modifiers)
{
    int index;
    int n_row_button = (x->j_box.b_rect.width - x->f_font.size * 1.24) / (x->f_font.size * 2.5) + 1;

    index = (int)((pt.y) / (x->f_font.size * 2.5)) * n_row_button;
    index += pd_clip_max((pt.x) / (x->f_font.size * 2.5) + 1, n_row_button);
    x->f_binbuf_hover = index;
    ebox_invalidate_layer((t_ebox *)x, cream_sym_background_layer);
    ebox_redraw((t_ebox *)x);
}
Exemplo n.º 2
0
static void preset_mousedown(t_presetobj *x, t_object *patcherview, t_pt pt, long modifiers)
{
    int index;
    int n_row_button = (x->j_box.b_rect.width - x->f_font.size * 1.24) / (x->f_font.size * 2.5) + 1;
    index = (int)((pt.y) / (x->f_font.size * 2.5)) * n_row_button;
    index += pd_clip_max((pt.x) / (x->f_font.size * 2.5) + 1, n_row_button);
    x->f_binbuf_hover = index;

    if(modifiers == EMOD_ALT)
        preset_clear(x, index);
    if(modifiers == EMOD_SHIFT)
        preset_store(x, index);
    preset_float(x, index);
}
Exemplo n.º 3
0
void draw_background(t_incdec *x, t_object *view, t_rect *rect)
{
    float height;
	t_elayer *g = ebox_start_layer((t_ebox *)x, gensym("background_layer"), rect->width, rect->height);

	if (g)
	{
        // Background //
        egraphics_set_color_rgba(g, &x->f_color_arrow);
        if(x->f_mouse_down == 1)
            egraphics_rectangle(g, 0, 0, rect->width, rect->height / 2.);
        else if(x->f_mouse_down == -1)
            egraphics_rectangle(g, 0, rect->height / 2., rect->width, rect->height);
        egraphics_fill(g);


        egraphics_set_color_rgba(g, &x->f_color_arrow);

        // Arrow Up //
        if(x->f_mouse_down == 1)
            egraphics_set_color_rgba(g, &x->f_color_background);
        else
            egraphics_set_color_rgba(g, &x->f_color_arrow);
#ifdef __APPLE__
        height = rect->height / 2. - 2;
        egraphics_move_to(g, rect->width * 0.1, pd_clip_max(height * 0.9, height - 1));
        egraphics_line_to(g, rect->width * 0.9, pd_clip_max(height * 0.9, height - 1));
        egraphics_line_to(g, rect->width * 0.5, pd_clip_min(height* 0.1, 1));
        egraphics_fill(g);
#elif _WINDOWS
        height = rect->height / 2. - 2;
        egraphics_move_to(g, rect->width * 0.1, pd_clip_max(height * 0.9, height - 1));
        egraphics_line_to(g, rect->width * 0.9, pd_clip_max(height * 0.9, height - 1));
        egraphics_line_to(g, rect->width * 0.5, pd_clip_min(height* 0.1, 1));
        egraphics_fill(g);
#else
        height = rect->height / 2.;
        egraphics_move_to(g, rect->width * 0.1, pd_clip_max(height * 0.9, height - 2));
        egraphics_line_to(g, rect->width * 0.9, pd_clip_max(height * 0.9, height - 2));
        egraphics_line_to(g, rect->width * 0.5, pd_clip_min(height* 0.1, 1));
        egraphics_fill(g);
#endif


        // Arrow Down //
        if(x->f_mouse_down == -1)
            egraphics_set_color_rgba(g, &x->f_color_background);
        else
            egraphics_set_color_rgba(g, &x->f_color_arrow);
#ifdef __APPLE__
        egraphics_move_to(g, rect->width * 0.1, pd_clip_min(height * 0.1 + rect->height / 2. + 2.5, rect->height / 2. + 2.5));
        egraphics_line_to(g, rect->width * 0.9, pd_clip_min(height * 0.1 + rect->height / 2. + 2.5, rect->height / 2. + 2.5));
        egraphics_line_to(g, rect->width * 0.5, pd_clip_max(height * 0.9 + rect->height / 2. + 2.5, rect->height - 1));
        egraphics_fill(g);

#elif _WINDOWS
        egraphics_move_to(g, rect->width * 0.1, pd_clip_min(height * 0.1 + rect->height / 2. + 2.5, rect->height / 2. + 2.5));
        egraphics_line_to(g, rect->width * 0.9, pd_clip_min(height * 0.1 + rect->height / 2. + 2.5, rect->height / 2. + 2.5));
        egraphics_line_to(g, rect->width * 0.5, pd_clip_max(height * 0.9 + rect->height / 2. + 2.5, rect->height - 1));
        egraphics_fill(g);

#else
        egraphics_move_to(g, rect->width * 0.1, pd_clip_min(height * 0.1 + rect->height / 2. + 1, rect->height / 2. + 2.5));
        egraphics_line_to(g, rect->width * 0.9, pd_clip_min(height * 0.1 + rect->height / 2. + 1, rect->height / 2. + 2.5));
        egraphics_line_to(g, rect->width * 0.5, pd_clip_max(height * 0.9 + rect->height / 2. + 1, rect->height - 1));
        egraphics_fill(g);
#endif

        // Middle Line //
        egraphics_set_color_rgba(g, &x->f_color_border);
        egraphics_set_line_width(g, 2);
        egraphics_line_fast(g, 0., rect->height / 2. + 0.5, rect->width, rect->height / 2. + 0.5);

        ebox_end_layer((t_ebox*)x, gensym("background_layer"));
	}
	ebox_paint_layer((t_ebox *)x, gensym("background_layer"), 0., 0.);
}