Пример #1
0
static void vfad_scale_draw_move(t_vfad_scale *x, t_glist *glist)
{
  int xpos=text_xpix(&x->x_gui.x_obj, glist);
  int ypos=text_ypix(&x->x_gui.x_obj, glist);
  t_canvas *canvas=glist_getcanvas(glist);
  
  sys_vgui(".x%x.c coords %xPHOTO %d %d\n",
    canvas, x, xpos+x->x_gui.x_w/2, ypos+x->x_gui.x_h/2);
  if(x->x_gui.x_fsf.x_selected)
    sys_vgui(".x%x.c coords %xBASE %d %d %d %d\n",
    canvas, x, xpos, ypos,
    xpos + x->x_gui.x_w, ypos + x->x_gui.x_h);
  canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
}
Пример #2
0
static void photo_displace(t_gobj *z, t_glist *glist,
                           int dx, int dy)
{
    t_photo *x = (t_photo *)z;
    x->x_obj.te_xpix += dx;
    x->x_obj.te_ypix += dy;
    sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n",
             glist_getcanvas(glist), x,
             text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
             text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);

    photo_drawme(x, glist, 0);
    canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x);
}
Пример #3
0
static void image_displace_wtag(t_gobj *z, t_glist *glist,
    int dx, int dy)
{
	//fprintf(stderr,"image displace_wtag\n");
    t_image *x = (t_image *)z;
    x->x_obj.te_xpix += dx;
    x->x_obj.te_ypix += dy;
    /*sys_vgui(".x%lx.c coords %xSEL %d %d %d %d\n",
		   glist_getcanvas(glist), x,
		   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
		   text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);

    image_drawme(x, glist, 0);*/
    canvas_fixlinesfor(glist,(t_text*) x);
}
Пример #4
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);
    }
}
Пример #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
static void draw_new(t_tg* tg, t_glist *glist) {
  t_canvas *canvas = glist_getcanvas(glist);
  int c,r;
  int curx,cury;
  int w = full_width(tg);
  int h = full_height(tg);

  tg->canvas = canvas;

  curx = text_xpix(&tg->x_obj, glist)+tg->spacing;
  cury = text_ypix(&tg->x_obj, glist)+tg->spacing;

  for (r = 0;r < tg->rows;r++) {
    for (c = 0;c < tg->cols;c++) {
      if (toggle_val(tg,c,r) != '0')
        sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill %s -tags %lxTGLSQ%d.%d\n",
                 canvas, curx, cury, curx + tg->cell_size, cury + tg->cell_size, tg->tglfill, tg, c, r);
      else
        //sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill [.x%lx.c cget -background] -tags %lxTGLSQ%d.%d\n",
        sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill %s -tags %lxTGLSQ%d.%d\n",
                 canvas, curx, cury, curx + tg->cell_size, cury + tg->cell_size, tg->untglfill, tg, c, r);

      //set up highlighting
      sys_vgui(".x%lx.c bind %lxTGLSQ%d.%d <Enter> {.x%lx.c itemconfigure %lxTGLSQ%d.%d -outline #FF0000}\n",
               canvas,tg,c,r,canvas,tg,c,r);
      sys_vgui(".x%lx.c bind %lxTGLSQ%d.%d <Leave> {.x%lx.c itemconfigure %lxTGLSQ%d.%d -outline #000000}\n",
               canvas,tg,c,r,canvas,tg,c,r);
      curx += (tg->cell_size+tg->spacing);
    }
    curx = text_xpix(&tg->x_obj, glist)+tg->spacing;
    cury += (tg->cell_size+tg->spacing);
  }

  curx = text_xpix(&tg->x_obj, glist);
  cury = text_ypix(&tg->x_obj, glist);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxTGLBOUND\n",
           canvas, curx, cury, curx + w, cury + h, tg, canvas);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLIN1\n",
           canvas, curx, cury, curx + IOWIDTH, cury + 4, tg);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLIN2\n",
           canvas, curx+w-IOWIDTH, cury, curx + w, cury + 4, tg);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLOUT1\n",
           canvas, curx, cury+h-4, curx + IOWIDTH, cury + h, tg);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLOUT2\n",
           canvas, curx+w-IOWIDTH, cury+h-4, curx + w, cury + h, tg);
  canvas_fixlinesfor(canvas, (t_text*)tg);
}
Пример #7
0
static void grid_draw_move(t_grid *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);

    GRID_SYS_VGUI7(".x%lx.c coords %lxGRID %d %d %d %d\n",
                   canvas, x,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
                   text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height);
    GRID_SYS_VGUI7(".x%lx.c coords %lxo0 %d %d %d %d\n",
                   canvas, x,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
                   text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2 );
    GRID_SYS_VGUI7(".x%lx.c coords %lxo1 %d %d %d %d\n",
                   canvas, x,
                   text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
                   text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2 );
    if ( x->x_point )
    {
        grid_draw_update(x, glist);
    }
    if ( x->x_grid )
    {
        int xlpos = text_xpix(&x->x_obj, glist)+x->x_width/x->x_xlines;
        int ylpos = text_ypix(&x->x_obj, glist)+x->x_height/x->x_ylines;
        int xcount = 1;
        int ycount = 1;
        while ( xlpos < text_xpix(&x->x_obj, glist)+x->x_width )
        {
            GRID_SYS_VGUI9(".x%lx.c coords %lxLINE%d%d %d %d %d %d\n",
                           canvas, x, xcount, 0, xlpos, text_ypix(&x->x_obj, glist),
                           xlpos, text_ypix(&x->x_obj, glist) + x->x_height);
            xlpos+=x->x_width/x->x_xlines;
            xcount++;
        }
        while ( ylpos < text_ypix(&x->x_obj, glist)+x->x_height )
        {
            GRID_SYS_VGUI9(".x%lx.c coords %lxLINE%d%d %d %d %d %d\n",
                           canvas, x, 0, ycount, text_xpix(&x->x_obj, glist), ylpos,
                           text_xpix(&x->x_obj, glist) + x->x_width, ylpos);
            ylpos+=x->x_height/x->x_ylines;
            ycount++;
        }
    }
    canvas_fixlinesfor( canvas, (t_text*)x );
}
Пример #8
0
static void grid_draw_new(t_grid *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);

    GRID_SYS_VGUI8(".x%lx.c create rectangle %d %d %d %d -fill %s -tags %lxGRID\n",
                   canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
                   text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
                   x->x_bgcolor, x);
    GRID_SYS_VGUI7(".x%lx.c create rectangle %d %d %d %d -tags %lxo0\n",
                   canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
                   text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2,
                   x);
    GRID_SYS_VGUI7(".x%lx.c create rectangle %d %d %d %d -tags %lxo1\n",
                   canvas, text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
                   text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2,
                   x);

    if ( x->x_grid )
    {
        int xlpos = text_xpix(&x->x_obj, glist)+x->x_width/x->x_xlines;
        int ylpos = text_ypix(&x->x_obj, glist)+x->x_height/x->x_ylines;
        int xcount = 1;
        int ycount = 1;
        while ( xlpos < text_xpix(&x->x_obj, glist)+x->x_width )
        {
            GRID_SYS_VGUI9(".x%lx.c create line %d %d %d %d -fill #FFFFFF -tags %lxLINE%d%d\n",
                           canvas, xlpos, text_ypix(&x->x_obj, glist),
                           xlpos, text_ypix(&x->x_obj, glist)+x->x_height,
                           x, xcount, 0 );
            xlpos+=x->x_width/x->x_xlines;
            xcount++;
        }
        while ( ylpos < text_ypix(&x->x_obj, glist)+x->x_height )
        {
            GRID_SYS_VGUI9(".x%lx.c create line %d %d %d %d -fill #FFFFFF -tags %lxLINE%d%d\n",
                           canvas, text_xpix(&x->x_obj, glist), ylpos,
                           text_xpix(&x->x_obj, glist)+x->x_width, ylpos,
                           x, 0, ycount);
            ylpos+=x->x_height/x->x_ylines;
            ycount++;
        }
    }
    canvas_fixlinesfor( canvas, (t_text*)x );
}
Пример #9
0
static void exciter_draw_new(t_exciter *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);
    t_int ei;

    SYS_VGUI7(".x%lx.c create rectangle %d %d %d %d -outline #000000 -fill #902181 -tags %xLINE\n",
              canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
              text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height,
              x);
    SYS_VGUI5(".x%lx.c create text %d %d -font -*-courier-bold--normal--10-* -text \"0 s\" -tags %xLOWERCAPTION\n",
              canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height + 10, x );
    SYS_VGUI6(".x%lx.c create text %d %d -font -*-courier-bold--normal--10-* -text \"%.2f s\" -tags %xHIGHERCAPTION\n",
              canvas, text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height + 10,
              x->x_width/EXCITER_PIXEL_GRAIN*x->x_timegrain , x);
    SYS_VGUI7(".x%lx.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xIN\n",
              canvas, text_xpix(&x->x_obj, glist),
              text_ypix(&x->x_obj, glist) - 2,
              text_xpix(&x->x_obj, glist) + 5,
              text_ypix(&x->x_obj, glist) ,
              x);
    if ( x->x_nbevents > 1 )
    {
        for ( ei=0; ei<x->x_nbevents; ei++ )
        {
            SYS_VGUI8(".x%lx.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT%d\n",
                      canvas, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1),
                      text_ypix(&x->x_obj, glist) + x->x_height,
                      text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1) + 5,
                      text_ypix(&x->x_obj, glist) + x->x_height + 2,
                      x, ei);
        }
    }
    else
    {
        SYS_VGUI8(".x%lx.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT%d\n",
                  canvas, text_xpix(&x->x_obj, glist),
                  text_ypix(&x->x_obj, glist) + x->x_height,
                  text_xpix(&x->x_obj, glist) + 5,
                  text_ypix(&x->x_obj, glist) + x->x_height + 2,
                  x, 0);
    }
    canvas_fixlinesfor( canvas, (t_text*)x );
}
Пример #10
0
static void scratcher_draw_move(t_scratcher *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);
    t_int ci;

    if ( glist_isvisible( x->x_glist ) )
    {
        SYS_VGUI7(".x%lx.c coords %xSCRATCHER %d %d %d %d\n",
                  canvas, x,
                  text_xpix(&x->x_obj, glist)-1, text_ypix(&x->x_obj, glist)-1,
                  text_xpix(&x->x_obj, glist)+x->x_width+1,
                  text_ypix(&x->x_obj, glist)+x->x_height+1);
        SYS_VGUI7(".x%lx.c coords %xFSCRATCHER %d %d %d %d\n",
                  canvas, x,
                  text_xpix(&x->x_obj, glist)-1, text_ypix(&x->x_obj, glist)-1,
                  text_xpix(&x->x_obj, glist)+x->x_width+1,
                  text_ypix(&x->x_obj, glist)+x->x_height+1);
        if ( x->x_showspeed )
        {
            SYS_VGUI7( ".x%lx.c coords %xSPEEDBAR %d %d %d %d\n",
                       canvas, x,
                       text_xpix(&x->x_obj, glist)+x->x_width/2,
                       text_ypix(&x->x_obj, glist)+x->x_height/2,
                       text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
                       text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                     );
        }
        for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
        {
            SYS_VGUI8(".x%lx.c coords %xGROOVE%d %d %d %d %d\n",
                      canvas, x, ci,
                      text_xpix(&x->x_obj, glist) + ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
                      text_ypix(&x->x_obj, glist) + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
                      text_xpix(&x->x_obj, glist) + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
                      text_ypix(&x->x_obj, glist) + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES)
                     );
        }
        canvas_fixlinesfor( canvas, (t_text*)x );
    }
}
Пример #11
0
void iem_vu_dialog(t_iem_vu *x, t_symbol *s, int argc, t_atom *argv)
{
  t_symbol *srl[3];
  int w = (int)atom_getintarg(0, argc, argv);
  int scale = (int)atom_getintarg(4, argc, argv);
  int sr_flags;
  
  srl[0] = gensym("empty");
  sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
  //  post("srl-flag = %x", sr_flags);
  x->x_gui.x_fsf.x_snd_able = 0;
  x->x_gui.x_isa.x_loadinit = 0;
  x->x_gui.x_w = iem_vu_clip_width(w+1);
  x->x_gui.x_h = 120;
  if(scale != 0)
    scale = 1;
  iem_vu_scale(x, (t_float)scale);
  (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
  (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
  (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
  canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
}
Пример #12
0
void eobj_resize_inputs(void *x, long nins)
{
    int i, cinlts;
    t_eobj* obj = (t_eobj *)x;
    nins = (long)pd_clip_min(nins, 1);
    cinlts = obj_nsiginlets((t_object *)x);
    if(nins > cinlts)
    {
        for(i = cinlts; i < nins; i++)
        {
            eproxy_new(obj, &s_signal);
        }
    }
    else if(nins < cinlts)
    {
        for(i = obj->o_nproxy - 1; i >= nins; --i)
        {
            eproxy_free(obj, obj->o_proxy[i]);
        }
    }
    canvas_fixlinesfor(eobj_getcanvas(obj), (t_text *)x);
}
Пример #13
0
static void iem_event_size(t_iem_event *x, t_symbol *s, int ac, t_atom *av)
{
  int h, w;
  
  if((ac >= 2)&&IS_A_FLOAT(av, 0) && IS_A_FLOAT(av, 1))
  {
    w = (int)atom_getintarg(0, ac, av);
    if(w < 4)
      w = 4;
    x->x_gui.x_w = w;
    if(ac > 1)
    {
      h = (int)atom_getintarg(1, ac, av);
      if(h < 4)
        h = 4;
      x->x_gui.x_h = h;
    }
    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
    canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
  }
}
Пример #14
0
void canvas_resortoutlets(t_canvas *x)
{
    int noutlets = 0, i, j, xmax;
    t_gobj *y, **vec, **vp, **maxp;

    for (noutlets = 0, y = x->gl_list; y; y = y->g_next)
        if (pd_class(&y->g_pd) == voutlet_class) noutlets++;

    if (noutlets < 2) return;

    vec = (t_gobj **)getbytes(noutlets * sizeof(*vec));

    for (y = x->gl_list, vp = vec; y; y = y->g_next)
        if (pd_class(&y->g_pd) == voutlet_class) *vp++ = y;

    for (i = noutlets; i--;)
    {
        t_outlet *ip;
        for (vp = vec, xmax = -0x7fffffff, maxp = 0, j = noutlets;
                j--; vp++)
        {
            int x1, y1, x2, y2;
            t_gobj *g = *vp;
            if (!g) continue;
            gobj_getrect(g, x, &x1, &y1, &x2, &y2);
            if (x1 > xmax) xmax = x1, maxp = vp;
        }
        if (!maxp) break;
        y = *maxp;
        *maxp = 0;
        ip = voutlet_getit(&y->g_pd);

        obj_moveoutletfirst(&x->gl_obj, ip);
    }
    freebytes(vec, noutlets * sizeof(*vec));
    if (x->gl_owner && glist_isvisible(x->gl_owner))
        canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
}
Пример #15
0
static void scopehandle__clickhook(t_scopehandle *sh, t_floatarg f)
{
    int newstate = (int)f;
    if (sh->h_dragon && newstate == 0)
    {
	t_scope *x = sh->h_master;
	t_canvas *cv;
	x->x_width += sh->h_dragx;
	x->x_height += sh->h_dragy;
	if (cv = scope_isvisible(x))
	{
	    sys_vgui(".x%lx.c delete %s\n", cv, sh->h_outlinetag);
	    scope_revis(x, cv);
	    sys_vgui("destroy %s\n", sh->h_pathname);
	    scope_select((t_gobj *)x, x->x_glist, 1);
	    canvas_fixlinesfor(x->x_glist, (t_text *)x);  /* 2nd inlet */
	}
    }
    else if (!sh->h_dragon && newstate)
    {
	t_scope *x = sh->h_master;
	t_canvas *cv;
	if (cv = scope_isvisible(x))
	{
	    int x1, y1, x2, y2;
	    scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
	    sys_vgui("lower %s\n", sh->h_pathname);
	    sys_vgui(".x%lx.c create rectangle %d %d %d %d\
 -outline blue -width %f -tags %s\n",
		     cv, x1, y1, x2, y2, SCOPE_SELBDWIDTH, sh->h_outlinetag);
	}
	sh->h_dragx = 0;
	sh->h_dragy = 0;
    }
    sh->h_dragon = newstate;
}
Пример #16
0
/* trigger events -- no dsp processing */
static void exciter_dialog(t_exciter *x, t_symbol *s, int argc, t_atom *argv)
{
    t_int onbevents, owidth, ei, gi, bi;
    t_canvas *canvas=glist_getcanvas(x->x_glist);

    if ( !x )
    {
        post( "exciter : error :tried to set properties on an unexisting object" );
    }
    onbevents = x->x_nbevents;
    owidth = x->x_width;
    exciter_draw_erase(x, x->x_glist);
    if ( argc < 6 )
    {
        post( "exciter : error in the number of arguments ( %d )", argc );
        return;
    }
    if ( argv[0].a_type != A_FLOAT || argv[1].a_type != A_FLOAT ||
            argv[2].a_type != A_FLOAT || argv[3].a_type != A_FLOAT ||
            argv[4].a_type != A_FLOAT || argv[5].a_type != A_FLOAT )
    {
        post( "exciter : wrong arguments" );
        return;
    }

    exciter_pause( x );
    x->x_width = argv[0].a_w.w_float;
    if ( x->x_width <= 0 ) x->x_width = 100;
    x->x_height = argv[1].a_w.w_float;
    if ( x->x_height <= 0 ) x->x_height = 100;
    x->x_nbevents = argv[2].a_w.w_float;
    if ( x->x_nbevents < 1 ) x->x_nbevents = 1;
    x->x_timegrain = argv[3].a_w.w_float;
    if ( x->x_timegrain < 0.01 )
    {
        post ("exciter : incorrect time grain : forced to 1 tick ( 10 ms )" );
        x->x_timegrain = 0.01;
    }
    x->x_loop = argv[4].a_w.w_float;
    x->x_save = argv[5].a_w.w_float;
    x->x_started = 0;
    x->x_reltime = 0L;
    x->x_plooptime = 0L;
    x->x_gindex = -1;
    x->x_looplength = x->x_timegrain * x->x_width * 1000 / EXCITER_PIXEL_GRAIN;

    // re-allocate arrays and keep old events
    post( "exciter : re-allocate events" );
    if ( onbevents != x->x_nbevents || owidth != x->x_width )
    {
        t_int mevents = ( onbevents > x->x_nbevents ) ? x->x_nbevents : onbevents;
        t_int mwidth = ( owidth > x->x_width ) ? x->x_width : owidth;
        t_int *newbangs;

        newbangs = (t_int*) getbytes( x->x_nbevents*x->x_width/EXCITER_PIXEL_GRAIN*sizeof(t_int) );
        memset( newbangs, 0x0, x->x_nbevents*x->x_width/EXCITER_PIXEL_GRAIN*sizeof(t_int) );
        for ( ei=0; ei<mevents; ei++ )
        {
            for ( gi=0; gi<(mwidth/EXCITER_PIXEL_GRAIN); gi++ )
            {
                *(newbangs+ei*(x->x_width/EXCITER_PIXEL_GRAIN)+gi ) =
                    *(x->x_sbangs+ei*(owidth/EXCITER_PIXEL_GRAIN)+gi );
            }
        }
        if ( x->x_sbangs )
            freebytes( x->x_sbangs, onbevents*owidth/EXCITER_PIXEL_GRAIN*sizeof(t_int) );
        x->x_sbangs = newbangs;
    }

    // re-allocate outlets
    post( "exciter : re-allocate outlets" );
    if ( onbevents != x->x_nbevents )
    {
        post( "exciter : cleaning up old outlets" );
        if ( x->x_bangs )
        {
            for ( ei=0; ei<onbevents; ei++ )
            {
                outlet_free( x->x_bangs[ei] );
            }
            freebytes( x->x_bangs, onbevents*sizeof(t_outlet*) );
        }
        post( "exciter : creating new ones" );
        x->x_bangs = (t_outlet **) getbytes( x->x_nbevents*sizeof(t_outlet **) );
        for ( bi=0; bi<x->x_nbevents; bi++ )
        {
            x->x_bangs[bi] = outlet_new( &x->x_obj, &s_bang );
        }
    }
    canvas_fixlinesfor( canvas, (t_text*)x );
    exciter_draw_new(x, x->x_glist);
    exciter_draw_update(x, x->x_glist);
    exciter_resume( x );
}
Пример #17
0
void odisplay_drawElements(t_object *ob, int firsttime)
{
    
    t_odisplay *x = (t_odisplay *)ob;
    t_opd_textbox *t = x->textbox;
    
    
    if(!opd_textbox_shouldDraw(t))
        return;
    
    int have_new_data = 0;
    int draw_new_data_indicator = 0;
    critical_enter(x->lock);
    have_new_data = x->have_new_data;
    draw_new_data_indicator = x->draw_new_data_indicator;
    critical_exit(x->lock);
    if(have_new_data){
        odisplay_bundle2text(x);
    }
    
    // odisplay_bundle2text(x);
    
    int x1, y1, x2, y2;
    odisplay_getrect((t_gobj *)x, t->glist, &x1, &y1, &x2, &y2);

    int rpix = x->roundpix;
    int rmargin = rpix;
    int mx1 = x1 - rmargin;
    int mx2 = x2;
    
    int x1a = mx1;
    int y1a = y1 + rpix;
    int x1b = mx1 + rpix;
    int y1b = y1;
    
    int x2a = mx2 - rpix;
    int y2a = y1;
    int x2b = mx2;
    int y2b = y1 + rpix;
    
    int x3a = mx2;
    int y3a = y2 - rpix;
    int x3b = mx2 - rpix;
    int y3b = y2;

    int x4a = mx1 + rpix;
    int y4a = y2;
    int x4b = mx1;
    int y4b = y2 - rpix;
    
    int rx1 = x1 + t->margin_l;
    int ry1 = y1 + t->margin_t;
    int rx2 = x2 - t->margin_r;
    int ry2 = y2 - t->margin_b;
    
    t_glist *glist = t->glist;
    t_canvas *canvas = glist_getcanvas(glist);
    
    
    //    post("%x %s %d %d\n", x, __func__, firsttime, t->firsttime);
    
    if (glist_isvisible(glist) && canvas->gl_editor)
    {
        
        
        if (firsttime)
        {
//              post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2);
            
            //box
            sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d -outline %s -width 2 -fill %s -tags %s\n", canvas, x1a, y1a, x1b, y1b, x2a, y2a, x2b, y2b, x3a, y3a, x3b, y3b, x4a, y4a, x4b, y4b, x->frame_color->hex, x->background_color->hex, x->tk_tag);
            sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d %d %d -outline \"\" -fill %s -tags %sBOTTOM \n", canvas, mx1, ry2, mx2, ry2, x3a, y3a, x3b, y3b, x4a, y4a, x4b, y4b, x->frame_color->hex, x->tk_tag);
            
            //update dot
            sys_vgui(".x%lx.c create oval %d %d %d %d -fill %s -outline \"\" -tags %sUPDATE \n", canvas, x2-10, y1+5, x2-5, y1+10, x->background_color->hex, x->tk_tag);
            
        }
        else
        {
            //  post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2);
            
            sys_vgui(".x%lx.c coords %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \n", canvas, x->tk_tag, x1a, y1a, x1b, y1b, x2a, y2a, x2b, y2b, x3a, y3a, x3b, y3b, x4a, y4a, x4b, y4b);
            sys_vgui(".x%lx.c coords %sBOTTOM %d %d %d %d %d %d %d %d %d %d %d %d \n", canvas, x->tk_tag, mx1, ry2, mx2, ry2, x3a, y3a, x3b, y3b, x4a, y4a, x4b, y4b);
            
            //sys_vgui(".x%lx.c coords %s %d %d %d %d %d %d %d %d %d %d %d %d \n",canvas, x->tk_tag, x1, y1, x2, y1, x2, ry2, rx2, ry2, rx2, y2, x1, y2);
        }
        
        opd_textbox_drawElements(x->textbox, x1,  y1,  x2,  y2,  firsttime);
        
        sys_vgui(".x%lx.c itemconfigure %sUPDATE -fill %s \n", canvas, x->tk_tag, (draw_new_data_indicator?  x->flash_color->hex : x->background_color->hex ));
        
        if(draw_new_data_indicator)
            clock_delay(x->new_data_indicator_clock, 100);
        
        /* draw inlets/outlets */
        t_object *ob = pd_checkobject(&x->ob.te_pd);
        if (ob){
            glist_drawiofor(glist, ob, firsttime, t->iolets_tag, x1, y1, x2, y2);
            canvas_fixlinesfor(glist, ob);
        }
        
        if (firsttime) /* raise cords over everything else */
            sys_vgui(".x%lx.c raise cord\n", glist_getcanvas(glist));
        
        

    }
}