Esempio n. 1
0
static void odisplay_delete(t_gobj *z, t_glist *glist)
{
    //post("%s", __func__);
    t_odisplay *x = (t_odisplay *)z;
    t_opd_textbox *t = x->textbox;
    t_canvas *canvas = glist_getcanvas(glist);
    t_object *ob = pd_checkobject(&x->ob.te_pd);

    //post("%x %s %d", x, __func__, canvas->gl_editor);
    
    if(!t->firsttime && canvas->gl_editor)
    {
        //        opd_textbox_nofocus_callback(t);
        
        sys_vgui(".x%lx.c delete %s\n", canvas, x->tk_tag);
        sys_vgui(".x%lx.c delete %sUPDATE\n", canvas, x->tk_tag);
        sys_vgui(".x%lx.c delete %sBOTTOM\n", canvas, x->tk_tag);
        
        opd_textbox_delete(t, glist);
    }
    
    if(ob && !t->firsttime && glist_isvisible(glist))
    {
        glist_eraseiofor(glist, ob, t->iolets_tag);
    }

    canvas_deletelinesfor(glist, (t_text *)z);
}
Esempio n. 2
0
    /* Note that some code in here would also be useful for drawing
    graph decorations in toplevels... */
static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
{
    t_glist *x = (t_glist *)gr;
    char tag[50];
    t_gobj *g;
    int x1, y1, x2, y2;
        /* ordinary subpatches: just act like a text object */
    if (!x->gl_isgraph)
    {
        text_widgetbehavior.w_visfn(gr, parent_glist, vis);
        return;
    }

    if (vis && canvas_showtext(x))
        rtext_draw(glist_findrtext(parent_glist, &x->gl_obj));
    graph_getrect(gr, parent_glist, &x1, &y1, &x2, &y2);
    if (!vis)
        rtext_erase(glist_findrtext(parent_glist, &x->gl_obj));

    sprintf(tag, "graph%lx", (t_int)x);
    if (vis)
        glist_drawiofor(parent_glist, &x->gl_obj, 1,
            tag, x1, y1, x2, y2);
    else glist_eraseiofor(parent_glist, &x->gl_obj, tag);
        /* if we look like a graph but have been moved to a toplevel,
        just show the bounding rectangle */
    if (x->gl_havewindow)
    {
        if (vis)
        {
            sys_vgui(".x%lx.c create polygon\
 %d %d %d %d %d %d %d %d %d %d -tags [list %s graph] -fill #c0c0c0\n",
                glist_getcanvas(x->gl_owner),
                x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag);
            sys_vgui(".x%lx.c raise cord\n", glist_getcanvas(x->gl_owner));
        }
        else
        {
            sys_vgui(".x%lx.c delete %s\n",
                glist_getcanvas(x->gl_owner), tag);
        }
        return;
    }
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;
}