Пример #1
0
/* redraw all the items in a glist.  We construe this to mean
redrawing in its own window and on parent, as needed in each case.
This is too conservative -- for instance, when you draw an "open"
rectangle on the parent, you shouldn't have to redraw the window!  */
void glist_redraw(t_glist *x)
{
    if (glist_isvisible(x))
    {
        /* LATER fix the graph_vis() code to handle both cases */
        if (glist_istoplevel(x))
        {
            t_gobj *g;
            t_linetraverser t;
            t_outconnect *oc;
            for (g = x->gl_list; g; g = g->g_next)
            {
                gobj_vis(g, x, 0);
                gobj_vis(g, x, 1);
            }
            /* redraw all the lines */
            linetraverser_start(&t, x);
            while (oc = linetraverser_next(&t))
                sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n",
                         glist_getcanvas(x), oc,
                         t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
            canvas_drawredrect(x, 0);
            if (x->gl_goprect)
            {
                canvas_drawredrect(x, 1);
            }
        }
        if (x->gl_owner && glist_isvisible(x->gl_owner))
        {
            graph_vis(&x->gl_gobj, x->gl_owner, 0);
            graph_vis(&x->gl_gobj, x->gl_owner, 1);
        }
    }
}
Пример #2
0
t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s)
{
    t_outlet *op = outlet_new(&x->gl_obj, s);
    if (!x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner))
    {
        gobj_vis(&x->gl_gobj, x->gl_owner, 0);
        gobj_vis(&x->gl_gobj, x->gl_owner, 1);
        canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
    }
    if (!x->gl_loading) canvas_resortoutlets(x);
    return (op);
}
Пример #3
0
void canvas_rminlet(t_canvas *x, t_inlet *ip)
{
    t_canvas *owner = x->gl_owner;
    int redraw = (owner && glist_isvisible(owner) && (!owner->gl_isdeleting)
                  && glist_istoplevel(owner));

    if (owner) canvas_deletelinesforio(owner, &x->gl_obj, ip, 0);
    if (redraw)
        gobj_vis(&x->gl_gobj, x->gl_owner, 0);
    inlet_free(ip);
    if (redraw)
    {
        gobj_vis(&x->gl_gobj, x->gl_owner, 1);
        canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
    }
}
Пример #4
0
void glist_add(t_glist *x, t_gobj *y)
{
    t_object *ob;
    y->g_next = 0;
    if (!x->gl_list) x->gl_list = y;
    else
    {
        t_gobj *y2;
        for (y2 = x->gl_list; y2->g_next; y2 = y2->g_next);
        y2->g_next = y;
    }
    if (x->gl_editor && (ob = pd_checkobject(&y->g_pd)))
        rtext_new(x, ob);
    if (x->gl_editor && x->gl_isgraph && !x->gl_goprect
            && pd_checkobject(&y->g_pd))
    {
        x->gl_goprect = 1;
        canvas_drawredrect(x, 1);
    }
    if (glist_isvisible(x))
        gobj_vis(y, x, 1);
    if (class_isdrawcommand(y->g_pd))
        canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(
                                        glist_getcanvas(x)->gl_name)), 0);
}
Пример #5
0
Файл: g_graph.c Проект: toto/ipd
t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *s)		
{
    t_inlet *ip = inlet_new(&x->gl_obj, who, s, 0);
//	if (!x->gl_owner)									//check for root canvas...	
//	{													//don't really need this, we need to search
//		printf("Awesome!\n");							// for where the canvas is created instead
//	}													// then we can determine if its the root
    if (!x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner))
    {
        gobj_vis(&x->gl_gobj, x->gl_owner, 0);
        gobj_vis(&x->gl_gobj, x->gl_owner, 1);
        canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
    }
    if (!x->gl_loading) canvas_resortinlets(x);
    return (ip);
}
Пример #6
0
void iemgui_shouldvis(t_iemgui *x, int mode)
{
    gop_redraw = 1;
    if(gobj_shouldvis((t_gobj *)x, x->x_glist))
    {
        if (!x->x_vis)
        {
            //fprintf(stderr,"draw new %d\n", mode);
            iemgui_draw_new(x);
            canvas_fixlinesfor(glist_getcanvas(x->x_glist), (t_text*)x);
            x->x_vis = 1;
            if (x->x_glist != glist_getcanvas(x->x_glist))
            {
                /* if we are inside gop and just have had our object's
                   properties changed we'll adjust our layer position
                   to ensure that ordering is honored */
                t_canvas *canvas = glist_getcanvas(x->x_glist);
                t_gobj *y = (t_gobj *)x->x_glist;
                gobj_vis(y, canvas, 0);
                gobj_vis(y, canvas, 1);
                // reorder it visually
                glist_redraw(canvas);

            }
        }
        //fprintf(stderr,"draw move x->x_w=%d\n", x->x_w);
        if      (mode==IEM_GUI_DRAW_MODE_NEW)    iemgui_draw_new(   x);
        else if (mode==IEM_GUI_DRAW_MODE_MOVE)   iemgui_draw_move(  x);
        else if (mode==IEM_GUI_DRAW_MODE_CONFIG) iemgui_draw_config(x);
        else bug("iemgui_shouldvis");
        scalehandle_check_and_redraw(x);
        canvas_fixlinesfor(glist_getcanvas(x->x_glist), (t_text*)x);
    }
    else if (x->x_vis)
    {
        //fprintf(stderr,"draw erase %d\n", mode);
        iemgui_draw_erase(x);
        x->x_vis = 0;
    }
    gop_redraw = 0;
}
Пример #7
0
/* delete an object from a glist and free it */
void glist_delete(t_glist *x, t_gobj *y)
{
    t_gobj *g;
    t_object *ob;
    t_gotfn chkdsp = zgetfn(&y->g_pd, gensym("dsp"));
    t_canvas *canvas = glist_getcanvas(x);
    int drawcommand = class_isdrawcommand(y->g_pd);
    int wasdeleting;

    wasdeleting = canvas_setdeleting(canvas, 1);
    if (x->gl_editor)
    {
        if (x->gl_editor->e_grab == y) x->gl_editor->e_grab = 0;
        if (glist_isselected(x, y)) glist_deselect(x, y);

        /* HACK -- we had phantom outlets not getting erased on the
        screen because the canvas_setdeleting() mechanism is too
        crude.  LATER carefully set up rules for when the rtexts
        should exist, so that they stay around until all the
        steps of becoming invisible are done.  In the meantime, just
        zap the inlets and outlets here... */
        if (pd_class(&y->g_pd) == canvas_class)
        {
            t_glist *gl = (t_glist *)y;
            if (gl->gl_isgraph && glist_isvisible(x))
            {
                char tag[80];
                sprintf(tag, "graph%lx", (t_int)gl);
                glist_eraseiofor(x, &gl->gl_obj, tag);
            }
            else
            {
                if (glist_isvisible(x))
                    text_eraseborder(&gl->gl_obj, x,
                                     rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
            }
        }
    }
    /* if we're a drawing command, erase all scalars now, before deleting
    it; we'll redraw them once it's deleted below. */
    if (drawcommand)
        canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(
                                        glist_getcanvas(x)->gl_name)), 2);
    gobj_delete(y, x);
    if (glist_isvisible(canvas))
    {
        gobj_vis(y, x, 0);
    }
    if (x->gl_editor && (ob = pd_checkobject(&y->g_pd)))
        rtext_new(x, ob);
    if (x->gl_list == y) x->gl_list = y->g_next;
    else for (g = x->gl_list; g; g = g->g_next)
            if (g->g_next == y)
            {
                g->g_next = y->g_next;
                break;
            }
    pd_free(&y->g_pd);
    if (chkdsp) canvas_update_dsp();
    if (drawcommand)
        canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(
                                        glist_getcanvas(x)->gl_name)), 1);
    canvas_setdeleting(canvas, wasdeleting);
    x->gl_valid = ++glist_valid;
}