Beispiel #1
0
static void iem_vu_scale(t_iem_vu *x, t_floatarg fscale)
{
  int i, scale = (int)fscale;
  
  if(scale != 0)
    scale = 1;
  if(x->x_scale && !scale)
  {
    x->x_scale = scale;
    if(glist_isvisible(x->x_gui.x_glist))
    {
      t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
      
      sys_vgui(".x%x.c delete %xSCALEPHOTO\n", canvas, x);
    }
  }
  if(!x->x_scale && scale)
  {
    x->x_scale = scale;
    if(glist_isvisible(x->x_gui.x_glist))
    {
      t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
      int xpos=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
      int ypos=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
      
      sys_vgui(".x%x.c create image %d %d -image %xSCALEIMAGE -tags %xSCALEPHOTO\n",
        canvas, xpos+x->x_gui.x_w+x->x_scale_w/2+3, ypos+x->x_gui.x_h/2+2, x, x);
      my_iemgui_change_scale_col(x->x_scale_gif, x->x_gui.x_lcol);
      sys_vgui("%xSCALEIMAGE configure -data {%s}\n", x, x->x_scale_gif);
    }
  }
}
Beispiel #2
0
static void image_imagesize_callback(t_image *x, t_float w, t_float h) {
	//fprintf(stderr,"received w %f h %f should %d spill %d\n", w, h, gobj_shouldvis((t_gobj *)x, glist_getcanvas(x->x_glist)), x->x_gop_spill);
	x->x_img_width = w;
	x->x_img_height = h;
	if (x->x_img_width + x->x_img_height == 0) {
		//invalid image
		if (strcmp("@pd_extra/ggee/empty_image.png", x->x_fname->s_name) != 0) {
			x->x_fname = gensym("@pd_extra/ggee/empty_image.png");
			image_doopen(x);
			return;
		}
	}
	if (!gobj_shouldvis((t_gobj *)x, x->x_glist) && !x->x_gop_spill) {
			//fprintf(stderr,"erasing\n");
			image_erase(x, glist_getcanvas(x->x_glist));
	} else {
		//sys_vgui("catch {.x%lx.c delete %xMT}\n", glist_getcanvas(x->x_glist), x);
		// reselect if we are on a toplevel canvas to adjust the selection rectangle, if necessary
		if (glist_isselected(x->x_glist, (t_gobj *)x) && glist_getcanvas(x->x_glist) == x->x_glist) {
			image_select((t_gobj *)x, glist_getcanvas(x->x_glist), 0);
			image_select((t_gobj *)x, glist_getcanvas(x->x_glist), 1);
		}
		canvas_fixlinesfor(x->x_glist,(t_text*) x);
	}
}
Beispiel #3
0
static void knob_draw_update(t_knob *x, t_glist *glist)
{
    if (glist_isvisible(glist) && 
        (x->x_gui.x_h != x->x_prev_h || x->x_val != x->x_prev_val))
    {
	/* compute dial:*/ 
        x->x_prev_h = x->x_gui.x_h;
        x->x_prev_val = x->x_val;
	float radius = 0.5*(float)x->x_gui.x_h;
	double angle = 7.0/36.0 + 34.0/36.0*2.0*M_PI*( (double)x->x_val*0.01/(double)x->x_gui.x_h );
	int start = -80;
	int extent = 350 - (int)(360.0*angle/(2.0*M_PI));
	/* center point: */
	int x1 = text_xpix(&x->x_gui.x_obj, glist) + radius;
	int y1 = text_ypix(&x->x_gui.x_obj, glist) + radius;
	int x2 = text_xpix(&x->x_gui.x_obj, glist) + radius + radius * sin( -angle); 
        int y2 = text_ypix(&x->x_gui.x_obj, glist) + radius + radius * cos(  angle);
	
	sys_vgui(".x%lx.c coords %xKNOB %d %d %d %d\n",
		glist_getcanvas(glist), x,
		x1,  /* x1 */     
		y1,  /* y1 */  
		x2,  /* x2 */
		y2   /* y2 */
		);
        
    	/* post("knob: (%d, %d) (%d, %d)", x1,y1,x2,y2); */
	
	sys_vgui(".x%lx.c itemconfigure %xBASE -start %d -extent %d \n", glist_getcanvas(glist), x,
	     start, extent);
    }
}
Beispiel #4
0
void toddle_drawme(t_toddle *x, t_glist *glist, int firsttime)
{
     if (firsttime) {
#if 0
	  sys_vgui(".x%lx.c create line \
%d %d %d %d %d %d %d %d %d %d -tags %xS\n",
		   glist_getcanvas(glist),
		   x->x_obj.te_xpos, x->x_obj.te_ypos,
		   x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos,
		   x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height,
		   x->x_obj.te_xpos, x->x_obj.te_ypos + x->x_height,
		   x->x_obj.te_xpos, x->x_obj.te_ypos,
		   x);
#endif

	  sys_vgui(".x%lx.c create rectangle \
%d %d %d %d -tags %xS "BACKGROUND"\n",
		   glist_getcanvas(glist),
		   x->x_obj.te_xpos, x->x_obj.te_ypos,
		   x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height,
		   x);
	  sys_vgui(".x%lx.c create oval \
%d %d %d %d -tags %xP\n",glist_getcanvas(glist),
		   x->x_obj.te_xpos+1,x->x_obj.te_ypos+1,
		   x->x_obj.te_xpos + x->x_width -1,
		   x->x_obj.te_ypos + x->x_height -1,x);
	  
     }     
     else {
Beispiel #5
0
static void image_displace(t_gobj *z, t_glist *glist,
    int dx, int dy)
{
	//fprintf(stderr,"image displace\n");
    t_image *x = (t_image *)z;
    x->x_obj.te_xpix += dx;
    x->x_obj.te_ypix += dy;
	if (!x->x_gop_spill && (x->x_img_width + x->x_img_height) >= 2){
		sys_vgui(".x%lx.c coords %xSEL %d %d %d %d\n",
			glist_getcanvas(glist), x,
			text_xpix(&x->x_obj, glist) - x->x_img_width/2,
			text_ypix(&x->x_obj, glist) - x->x_img_height/2,
			text_xpix(&x->x_obj, glist) + x->x_img_width/2,
			text_ypix(&x->x_obj, glist) + x->x_img_height/2);
	} else {
		sys_vgui(".x%lx.c coords %xSEL %d %d %d %d\n",
			glist_getcanvas(glist), 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,
			text_ypix(&x->x_obj, glist) + x->x_height/2);
		/*if (x->x_img_width + x->x_img_height == 0)
			sys_vgui(".x%lx.c coords %xMT %d %d %d %d\n",
				glist_getcanvas(glist), 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,
				text_ypix(&x->x_obj, glist) + x->x_height/2);*/
	}

    image_drawme(x, glist, 0);
    canvas_fixlinesfor(glist,(t_text*) x);
}
Beispiel #6
0
    void photo_drawme(t_photo *x, t_glist *glist, int firsttime)
{
	if (firsttime) 
    {
		char fname[MAXPDSTRING];
		canvas_makefilename(glist_getcanvas(x->x_glist), x->filename->s_name,
							fname, MAXPDSTRING);

        sys_vgui("image create photo img%x -file {%s}\n", x, fname);
        sys_vgui(".x%x.c create image %d %d -image img%x -anchor nw -tags %xS\n", 
                 glist_getcanvas(glist),text_xpix(&x->x_obj, glist), 
                 text_ypix(&x->x_obj, glist),x,x);

        /* TODO callback from gui
           sys_vgui("photo_size logo");
        */
    }     
    else 
    {
        sys_vgui(".x%x.c coords %xS %d %d\n",
                 glist_getcanvas(glist), x,
                 text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
    }
	
}
Beispiel #7
0
static void iem_image_draw_move(t_iem_image *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);

    if(x->x_have_image)
        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);
}
Beispiel #8
0
void toddle_drawbang(t_toddle *x,t_glist *glist,int on)
{
     if (glist_isvisible(glist)) {
	  if (on)
	       sys_vgui(".x%lx.c create oval %d %d %d %d -fill %s -tags %xB\n",glist_getcanvas(glist),
			x->x_obj.te_xpos+1,x->x_obj.te_ypos+1,
			x->x_obj.te_xpos + x->x_width -1,
			x->x_obj.te_ypos + x->x_height -1,x->x_color->s_name,x);
	  else
	       sys_vgui(".x%lx.c delete %xB\n",
			glist_getcanvas(glist), x);
     }
}
Beispiel #9
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);
}
Beispiel #10
0
void image_drawme(t_image *x, t_glist *glist, int firstime)
{
	if (firstime) {
		sys_vgui("catch {.x%lx.c delete %xS}\n", glist_getcanvas(glist), x);
		sys_vgui(".x%lx.c create image %d %d -tags %xS\n", 
			glist_getcanvas(glist),text_xpix(&x->x_obj, glist), 
			text_ypix(&x->x_obj, glist), x);
		image_doopen(x);
     }
     else {
		sys_vgui(".x%lx.c coords %xS %d %d\n",
			glist_getcanvas(glist), x,
			text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
     }
}
Beispiel #11
0
static void scrolllist_update(t_scrolllist *x, t_glist *glist)
{
  t_canvas *canvas=glist_getcanvas(glist);
  t_int i;

    // just in case we got confused
    if ( x->x_firstseen < 0 ) x->x_firstseen=0;
    if ( x->x_lastseen > x->x_capacity-1 ) x->x_lastseen=x->x_capacity-1;

    // display the content of text items
    for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
    {
       // display the entry if displayable
       if ( ( (i-x->x_firstseen)*x->x_charheight < x->x_height ) && ( x->x_items[i] != NULL ) )
       {
          SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text \"%s\" -anchor w -font %s -tags %xITEM%d\n",
                    canvas,
                    text_xpix(&x->x_obj, glist)+5,
                    text_ypix(&x->x_obj, glist)+5+(i-x->x_firstseen)*x->x_charheight,
                    x->x_fgcolor,
                    x->x_secolor,
                    x->x_width,
                    x->x_items[i],
                    x->x_font,
                    x, i );
        }
        if ( ( x->x_itemselected >= x->x_firstseen ) && ( x->x_itemselected <= x->x_lastseen ) )
        {
          SYS_VGUI5(".x%x.c itemconfigure %xITEM%d -fill %s\n", 
                     canvas, x, x->x_itemselected, x->x_secolor); 
        }
    }
}
Beispiel #12
0
static void imagebang_flash_timeout(t_imagebang *x)
{
	t_glist* glist = glist_getcanvas(x->glist);
    x->flashing = 0;
    sys_vgui(".x%x.c itemconfigure %ximage -image %x_imagebang \n", glist, x,x->image_a);
    
}
Beispiel #13
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);
}
Beispiel #14
0
void rtext_activate(t_rtext *x, int state)
{
    //fprintf(stderr, "rtext_activate\n");
    int w = 0, h = 0, indx;
    t_glist *glist = x->x_glist;
    t_canvas *canvas = glist_getcanvas(glist);
    if (state)
    {
        sys_vgui(".x%lx.c focus %s\n", canvas, x->x_tag);
        glist->gl_editor->e_textedfor = x;
        glist->gl_editor->e_textdirty = 0;
        x->x_dragfrom = x->x_selstart = 0;
        x->x_selend = x->x_bufsize;
        x->x_active = 1;
    }
    else
    {
        sys_vgui("selection clear .x%lx.c\n", canvas);
        sys_vgui(".x%lx.c focus \"\"\n", canvas);
        if (glist->gl_editor->e_textedfor == x)
            glist->gl_editor->e_textedfor = 0;
        x->x_active = 0;
    }
    rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);
}
Beispiel #15
0
void photo_erase(t_photo* x,t_glist* glist)
{
    int n;
    sys_vgui(".x%x.c delete %xS\n",
             glist_getcanvas(glist), x);

}
Beispiel #16
0
static void draw_move(t_tg *tg, t_glist *glist) {
  t_canvas *canvas = glist_getcanvas(glist);
  int i,j,curx,cury;
  int w = full_width(tg);
  int h = full_height(tg);

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

  for (j = 0;j < tg->rows;j++) {
    for (i = 0;i < tg->cols;i++) {
      sys_vgui(".x%lx.c coords %lxTGLSQ%d.%d %d %d %d %d\n",
               canvas, tg, i, j, curx, cury, curx + tg->cell_size, cury + tg->cell_size);
      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 coords %lxTGLBOUND %d %d %d %d\n",
           canvas, tg, curx, cury, curx + w, cury + h);
  sys_vgui(".x%lx.c coords %lxTGLIN1 %d %d %d %d\n",
           canvas, tg, curx, cury, curx + IOWIDTH, cury + 4);
  sys_vgui(".x%lx.c coords %lxTGLIN2 %d %d %d %d\n",
           canvas, tg, curx+w-IOWIDTH, cury, curx + w, cury + 4);
  sys_vgui(".x%lx.c coords %lxTGLOUT1 %d %d %d %d\n",
           canvas, tg, curx, cury+h-4, curx + IOWIDTH, cury + h);
  sys_vgui(".x%lx.c coords %lxTGLOUT2 %d %d %d %d\n",
           canvas, tg, curx+w-IOWIDTH, cury+h-4, curx + w, cury + h);
  canvas_fixlinesfor(canvas, (t_text*)tg);
}
static void *iem_send_kernel_new(void)
{
  t_iem_send_kernel *x = (t_iem_send_kernel *)pd_new(iem_send_kernel_class);
  t_glist *glist = (t_glist *)canvas_getcurrent();
  t_canvas *canvas=glist_getcanvas(glist);
  int ac=0;
  t_atom *av;
  
  canvas_setcurrent(canvas);
  canvas_getargs(&ac, &av);
  canvas_unsetcurrent(canvas);
  
  if(ac > 0)
  {
    if(IS_A_SYMBOL(av,0))
    {
      x->x_sym = atom_getsymbol(av);
    }
    else if(IS_A_FLOAT(av,0))
    {
      char str[100];
      
      sprintf(str, "%g", atom_getfloat(av));
      x->x_sym = gensym(str);
    }
    else
      x->x_sym = 0;
  }
  else
    x->x_sym = 0;
  return (x);
}
Beispiel #18
0
static void scrolllist_draw_move(t_scrolllist *x, t_glist *glist)
{  
  t_canvas *canvas=glist_getcanvas(glist);
  t_int i;
  struct timespec tv;
 
    tv.tv_sec = 0;
    tv.tv_nsec = 10000000;

    SYS_VGUI7(".x%x.c coords %xTEXTLIST %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);
    for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
    {
       // nanosleep( &tv, NULL );
       SYS_VGUI6(".x%x.c coords %xITEM%d %d %d\n",
             canvas, x, i,
             text_xpix(&x->x_obj, glist)+5,
             text_ypix(&x->x_obj, glist)+5+(i-x->x_firstseen)*x->x_charheight);
    }

    canvas_fixlinesfor( canvas, (t_text*)x );
}
Beispiel #19
0
static void scrolllist_motion(t_scrolllist *x, t_floatarg dx, t_floatarg dy)
{
 t_int i;
 t_canvas *canvas=glist_getcanvas(x->x_glist);
  
  x->x_cdy+=dy;
  scrolllist_erase( x, x->x_glist );
 
  // check if we need to scroll
  // eventually, move down
  if ( x->x_cdy >= x->x_charheight )
  {
     if ( x->x_firstseen < x->x_nitems - x->x_ndisplayed )
     {
         x->x_firstseen++;
         x->x_lastseen++;
         // post( "scrolllist : moved down first=%d last=%d", x->x_firstseen, x->x_lastseen );
     }
  }
  // eventually, move up
  if ( x->x_cdy <= -x->x_charheight )
  {
     if ( x->x_firstseen-1 >= 0 )
     {
        x->x_firstseen--;
        x->x_lastseen--;
        // post( "scrolllist : moved up first=%d last=%d", x->x_firstseen, x->x_lastseen );
     }
  }
  scrolllist_update(x, x->x_glist);
  if ( ( x->x_cdy >= x->x_charheight ) || ( x->x_cdy <= -x->x_charheight ) ) x->x_cdy = 0;
} 
Beispiel #20
0
static void exciter_draw_move(t_exciter *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);
    t_int polyray = ( x->x_height / x->x_nbevents) / 2;
    t_int ei, gi;

    SYS_VGUI7(".x%lx.c coords %xLINE %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
             );
    SYS_VGUI5(".x%lx.c coords %xLOWERCAPTION %d %d\n",
              canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height + 10 );
    SYS_VGUI5(".x%lx.c coords %xHIGHERCAPTION %d %d\n",
              canvas, x, text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height + 10);
    SYS_VGUI7(".x%lx.c coords %xIN %d %d %d %d\n",
              canvas, x, 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)
             );
    if ( x->x_nbevents > 1 )
    {
        for ( ei=0; ei<x->x_nbevents; ei++ )
        {
            SYS_VGUI8(".x%lx.c coords %xOUT%d %d %d %d %d\n",
                      canvas, x, ei, 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
                     );
        }
    }
    else
    {
        SYS_VGUI8(".x%lx.c coords %xOUT%d %d %d %d %d\n",
                  canvas, x, 0, 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
                 );
    }
    for ( ei=0; ei<x->x_nbevents; ei++ )
    {
        for ( gi=0; gi<(x->x_width/EXCITER_PIXEL_GRAIN); gi++ )
        {
            SYS_VGUI13(".x%lx.c coords %xEVENT%.4d%.4d %d %d %d %d %d %d %d %d\n",
                       canvas, x, gi, ei,
                       text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN,
                       text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents + 2*polyray,
                       text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN + polyray,
                       text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents + polyray,
                       text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN + 2*polyray,
                       text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents,
                       text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN + polyray,
                       text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents - polyray
                      );
        }
    }
    canvas_fixlinesfor( canvas, (t_text*)x );
}
Beispiel #21
0
static void imagebang_brk_timeout(t_imagebang *x)
{
	t_glist* glist = glist_getcanvas(x->glist);
    x->flashing = 1;
    sys_vgui(".x%lx.c itemconfigure %lximage -image %lx_imagebang \n", glist, x,x->image_b);
    
}
Beispiel #22
0
static void scratcher_draw_new(t_scratcher *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);
    t_int ci;

    SYS_VGUI7(".x%lx.c create oval %d %d %d %d -fill #000000 -tags %xSCRATCHER\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);
    for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
    {
        SYS_VGUI8(".x%lx.c create oval %d %d %d %d -outline #FFFFFF -tags %xGROOVE%d\n",
                  canvas, 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),
                  x, ci);
    }
    if ( x->x_showspeed )
    {
        SYS_VGUI7( ".x%lx.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
                   canvas, 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. )),
                   x );
    }
    SYS_VGUI7(".x%lx.c create rectangle %d %d %d %d -tags %xFSCRATCHER\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);
    canvas_fixlinesfor( canvas, (t_text*)x );
}
Beispiel #23
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);
        }
    }
}
Beispiel #24
0
/* widget helper functions */
static void mknob_update_knob(t_mknob *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);
//	float val=(x->x_val + 50.0)/100.0/MKNOB_TANGLE;
	float val=(x->x_val + 50.0)/100.0/x->x_H;
	float 	angle,
			radius=x->x_gui.x_w/2.0,
			miniradius=MKNOB_THICK;
	int x0,y0,x1,y1,xc,yc,xp,yp,xpc,ypc;
    x0=text_xpix(&x->x_gui.x_obj, glist);
    y0=text_ypix(&x->x_gui.x_obj, glist);
	x1=x0+x->x_gui.x_w;
	y1=y0+x->x_gui.x_w;
	xc=(x0+x1)/2;
	yc=(y0+y1)/2;
	
	if(x->x_gui.x_h<0)
		angle=val*(M_PI*2)+M_PI/2.0;
	else 
		angle=val*(M_PI*1.5)+3.0*M_PI/4.0;
		
	xp=xc+radius*cos(angle);
	yp=yc+radius*sin(angle);
	xpc=miniradius*cos(angle-M_PI/2);
	ypc=miniradius*sin(angle-M_PI/2);
	
	sys_vgui(".x%lx.c coords %xKNOB %d %d %d %d %d %d\n",
		canvas,x,xp,yp,xc+xpc,yc+ypc,xc-xpc,yc-ypc);
}
Beispiel #25
0
static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy)
{
    struct timeval tv;
    struct timezone tz;
    t_canvas *canvas=glist_getcanvas(x->x_glist);

    // post( "scratcher_motion dx=%f dy=%f", dx, dy );

    x->x_speedinc += dy / x->x_sensibility;

    x->x_mousemoved = 1;
    // get current time in ms
    gettimeofday( &tv, &tz );
    x->x_lastmovetime = tv.tv_sec*1000 + tv.tv_usec/1000;
    // post( "scratcher~ : move time : %ld", x->x_lastmovetime );

    if ( x->x_showspeed )
    {
        SYS_VGUI7( ".x%lx.c coords %xSPEEDBAR %d %d %d %d\n",
                   canvas, x,
                   text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
                   text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
                   text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
                   text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                 );
    }
}
Beispiel #26
0
static void iem_vu_update_peak(t_iem_vu *x, t_glist *glist)
{
  t_canvas *canvas=glist_getcanvas(glist);
  
  if(glist_isvisible(glist))
  {
    int xpos=text_xpix(&x->x_gui.x_obj, glist);
    int ypos=text_ypix(&x->x_gui.x_obj, glist);
    
    if(x->x_peak)
    {
      int i=iem_vu_col[x->x_peak];
      int j=ypos + 3*(IEM_VU_STEPS+1-x->x_peak) - 1;
      
      sys_vgui(".x%x.c coords %xPLED %d %d %d %d\n", canvas, x,
        xpos, j, xpos+x->x_gui.x_w, j);
      sys_vgui(".x%x.c itemconfigure %xPLED -fill #%6.6x\n", canvas, x, my_iemgui_color_hex[i]);
    }
    else
    {
      int mid=xpos+x->x_gui.x_w/2;
      
      sys_vgui(".x%x.c itemconfigure %xPLED -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol);
      sys_vgui(".x%x.c coords %xPLED %d %d %d %d\n",
        canvas, x, mid, ypos+20, mid, ypos+20);
    }
  }
}
Beispiel #27
0
static void iem_event_draw_erase(t_iem_event* x, t_glist* glist)
{
  t_canvas *canvas=glist_getcanvas(glist);
  
  if(x->x_gui.x_fsf.x_selected)
    sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
}
Beispiel #28
0
static int scratcher_click(t_gobj *z, struct _glist *glist,
                           int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
    t_scratcher* x = (t_scratcher *)z;
    t_canvas *canvas=glist_getcanvas(x->x_glist);

    // post( "scratcher_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
    if ( doit )
    {
        // activate motion callback
        glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)scratcher_motion,
                    0, xpix, ypix );
        x->x_readspeed=0.;
        x->x_motioned = 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 ))
                     );
        }
    }
    else
    {
        if ( x->x_play ) scratcher_reset(x);
        x->x_motioned = 0;
    }
    return (1);
}
Beispiel #29
0
void iemgui_select(t_gobj *z, t_glist *glist, int selected)
{
    t_iemgui *x = (t_iemgui *)z;
    t_canvas *canvas=glist_getcanvas(glist);
    if (selected)
        x->x_selected = canvas;
    else
        x->x_selected = NULL;
    sys_vgui(".x%lx.c itemconfigure {x%lx&&border} -stroke %s\n", canvas, x,
        x->x_selected && x->x_glist == canvas ? selection_color : border_color);
    x->x_draw((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT);
    if (selected < 2)
    {
        scalehandle_draw(x);
    }
    else
    {
        // exception where we get rid of handles when moving tiny objects
        // because tkpath's slowness sometimes makes mouse pointer go over
        // a handle and messes things up. we only do this when using
        // startmotion (see g_editor.c).
        // LATER: get rid of this because we will deal with this better using
        // the new toolkit.
        scalehandle_draw_erase2(x);
    }
    iemgui_label_draw_select(x);
    iemgui_tag_selected(x);
}
Beispiel #30
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);
}