Exemple #1
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;
    }
Exemple #2
0
static void pddplink_vis(t_gobj *z, t_glist *glist, int vis)
{
    t_pddplink *x = (t_pddplink *)z;
    t_rtext *y;
    if (vis)
    {
        if ((glist->gl_havewindow || x->x_isgopvisible)
            && (y = glist_findrtext(glist, (t_text *)x)))
        {
            rtext_draw(y);
	    sys_vgui(".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000\n",
		     glist_getcanvas(glist), rtext_gettag(y), x->x_vistext);
        }
    }
    else
    {
        if ((glist->gl_havewindow || x->x_isgopvisible)
	    && (y = glist_findrtext(glist, (t_text *)x)))
            rtext_erase(y);
    }
}