Esempio n. 1
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);
}
Esempio n. 2
0
static void scope_vis(t_gobj *z, t_glist *glist, int vis)
{
    t_scope *x = (t_scope *)z;
    t_text *t = (t_text *)z;
    t_canvas *cv = scope_getcanvas(x, glist);
    if (vis)
    {
	t_scopehandle *sh = (t_scopehandle *)x->x_handle;
#if FORKY_VERSION < 37
	rtext_new(glist, t, glist->gl_editor->e_rtext, 0);
#endif
	sprintf(sh->h_pathname, ".x%lx.h%lx", (unsigned long)cv, (unsigned long)sh);
	if (x->x_xymode)
	    scope_drawxy(x, cv);
	else
	    scope_drawmono(x, cv);
    }
    else
    {
#if FORKY_VERSION < 37
	t_rtext *rt = glist_findrtext(glist, t);
	if (rt) rtext_free(rt);
#endif
	sys_vgui(".x%lx.c delete %s\n", (unsigned long)cv, x->x_tag);
	x->x_canvas = 0;
    }
}
Esempio n. 3
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;
}