Пример #1
0
/* drawing functions */
static void grid_draw_update(t_grid *x, t_glist *glist)
{
    t_canvas *canvas=glist_getcanvas(glist);
    t_int xpoint=x->x_current, ypoint=x->y_current;

    // later : try to figure out what's this test for ??
    // if (glist_isvisible(glist))
    // {
    // delete previous point if existing
    if (x->x_point)
    {
        GRID_SYS_VGUI3(".x%lx.c delete %lxPOINT\n", canvas, x);
    }

    if ( x->x_current < text_xpix(&x->x_obj, glist) ) xpoint = text_xpix(&x->x_obj, glist);
    if ( x->x_current > text_xpix(&x->x_obj, glist) + x->x_width - pointsize )
        xpoint = text_xpix(&x->x_obj, glist) + x->x_width - pointsize;
    if ( x->y_current < text_ypix(&x->x_obj, glist) ) ypoint = text_ypix(&x->x_obj, glist);
    if ( x->y_current > text_ypix(&x->x_obj, glist) + x->x_height - pointsize )
        ypoint = text_ypix(&x->x_obj, glist) + x->x_height - pointsize;
    // draw the selected point
    GRID_SYS_VGUI7(".x%lx.c create rectangle %d %d %d %d -fill #FF0000 -tags %lxPOINT\n",
                   canvas, xpoint, ypoint, xpoint+pointsize, ypoint+pointsize, x);
    x->x_point = 1;
    // }
    // else
    // {
    //    post( "grid : position updated in an invisible grid" );
    // }
}
Пример #2
0
static void grid_xvaluemotion(t_grid* x, t_floatarg dx, t_floatarg dy)
{
    int xold = x->x_current;
    int yold = x->y_current;
    t_float xvalue, yvalue;

    xvalue = x->x_min + (x->x_current - text_xpix(&x->x_obj, x->x_glist)) * (x->x_max-x->x_min) / x->x_width ;
    if (xvalue < x->x_min ) xvalue = x->x_min;
    if (xvalue > x->x_max ) xvalue = x->x_max;

    yvalue = x->y_max - (x->y_current - text_ypix(&x->x_obj, x->x_glist) ) * (x->y_max-x->y_min) / x->x_height ;
    if (yvalue < x->y_min ) yvalue = x->y_min;
    if (yvalue > x->y_max ) yvalue = x->y_max;

    xvalue += dx;
    yvalue += dy;

    if (xvalue < x->x_min ) xvalue = x->x_min;
    if (xvalue > x->x_max ) xvalue = x->x_max;

    x->x_current = text_xpix(&x->x_obj, x->x_glist)
        + abs(((xvalue - x->x_min) / (x->x_max - x->x_min)) * x->x_width);

    if (yvalue < x->y_min ) yvalue = x->y_min;
    if (yvalue > x->y_max ) yvalue = x->y_max;

    x->y_current = text_ypix(&x->x_obj, x->x_glist)
        + abs((1 - (yvalue - x->y_min) / (x->y_max - x->y_min)) * x->x_height);

    if(xold != x->x_current || yold != x->y_current)
    {
        grid_draw_update(x, x->x_glist);
    }
}
Пример #3
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));
    }
	
}
Пример #4
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);
    }
}
Пример #5
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);
}
Пример #6
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 ))
                 );
    }
}
Пример #7
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);
}
Пример #8
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 );
}
Пример #9
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);
}
Пример #10
0
static void tglgrid_getrect(t_gobj *z, t_glist *owner,
                            int *xp1, int *yp1, int *xp2, int *yp2) {
   t_tg *tg = (t_tg*)z;
   *xp1 = text_xpix(&tg->x_obj, owner);
   *yp1 = text_ypix(&tg->x_obj, owner);
   *xp2 = text_xpix(&tg->x_obj, owner)+full_width(tg);
   *yp2 = text_ypix(&tg->x_obj, owner)+full_height(tg);
}
Пример #11
0
static void tglgrid_displace(t_gobj *z, t_glist *glist, int dx, int dy) {
  t_tg *tg = (t_tg *)z;
  int xold = text_xpix(&tg->x_obj, glist);
  int yold = text_ypix(&tg->x_obj, glist);
  tg->x_obj.te_xpix += dx;
  tg->x_obj.te_ypix += dy;
  if(xold != text_xpix(&tg->x_obj, glist) || yold != text_ypix(&tg->x_obj, glist))
    draw_move(tg, tg->glist);
}
Пример #12
0
static void photo_getrect(t_gobj *z, t_glist *glist,
                          int *xp1, int *yp1, int *xp2, int *yp2)
{
    t_photo* x = (t_photo*)z;

    *xp1 = text_xpix(&x->x_obj, glist);
    *yp1 = text_ypix(&x->x_obj, glist);
    *xp2 = text_xpix(&x->x_obj, glist) + x->x_width;
    *yp2 = text_ypix(&x->x_obj, glist) + x->x_height;
}
Пример #13
0
static void scrolllist_getrect(t_gobj *z, t_glist *owner,
			    int *xp1, int *yp1, int *xp2, int *yp2)
{
 t_scrolllist* x = (t_scrolllist*)z;

   *xp1 = text_xpix(&x->x_obj, owner);
   *yp1 = text_ypix(&x->x_obj, owner);
   *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
   *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
Пример #14
0
static void grid_getrect(t_gobj *z, t_glist *owner,
                         int *xp1, int *yp1, int *xp2, int *yp2)
{
    t_grid* x = (t_grid*)z;

    *xp1 = text_xpix(&x->x_obj, x->x_glist);
    *yp1 = text_ypix(&x->x_obj, x->x_glist);
    *xp2 = text_xpix(&x->x_obj, x->x_glist)+x->x_width;
    *yp2 = text_ypix(&x->x_obj, x->x_glist)+x->x_height;
}
Пример #15
0
static void photo_select(t_gobj *z, t_glist *glist, int state)
{
    t_photo *x = (t_photo *)z;
    if (state) {
        sys_vgui(".x%x.c create rectangle \
%d %d %d %d -tags %xSEL -outline blue\n",
                 glist_getcanvas(glist),
                 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);
    }
    else 
    {
Пример #16
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);
}
Пример #17
0
static void image_getrect(t_gobj *z, t_glist *glist,
                          int *xp1, int *yp1, int *xp2, int *yp2)
{
    int width, height;
    t_image *x = (t_image *)z;


    width = x->x_width;
    height = x->x_height;
    *xp1 = text_xpix(&x->x_obj, glist);
    *yp1 = text_ypix(&x->x_obj, glist);
    *xp2 = text_xpix(&x->x_obj, glist) + width;
    *yp2 = text_ypix(&x->x_obj, glist) + height;
}
Пример #18
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 );
}
Пример #19
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));
     }
}
Пример #20
0
static void scrolllist_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
  t_scrolllist *x = (t_scrolllist *)z;
  t_int xold = text_xpix(&x->x_obj, glist);
  t_int yold = text_ypix(&x->x_obj, glist);

    // post( "scrolllist_displace dx=%d dy=%d", dx, dy );

    x->x_obj.te_xpix += dx;
    x->x_obj.te_ypix += dy;
    if(xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist))
    {
	scrolllist_draw_move(x, glist);
    }
}
Пример #21
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);
    }
  }
}
Пример #22
0
static int exciter_click(t_gobj *z, struct _glist *glist,
                         int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
    t_exciter* x = (t_exciter *)z;
    t_int nevent, npix;

    if ( doit)
    {
        nevent = ( 1 - ( ( ypix - ( (float)x->x_height / (float) x->x_nbevents / 2 )
                           - text_ypix(&x->x_obj, glist)) / (float)x->x_height ) )*(x->x_nbevents-1);
        npix = ( xpix - 1  - text_xpix(&x->x_obj, glist)) / EXCITER_PIXEL_GRAIN;
        // post( "exciter : selected event (%d,%d)", nevent, npix );
        // set or unset event
        {
            if ( *(x->x_sbangs+nevent*(x->x_width/EXCITER_PIXEL_GRAIN)+npix ) == 1 )
            {
                *(x->x_sbangs+nevent*(x->x_width/EXCITER_PIXEL_GRAIN)+npix ) = 0;
                exciter_delete_gem( x, glist, npix, nevent );
            }
            else
            {
                *(x->x_sbangs+nevent*(x->x_width/EXCITER_PIXEL_GRAIN)+npix ) = 1;
                exciter_draw_gem( x, glist, npix, nevent );
            }
        }
    }
    return (1);
}
Пример #23
0
static void col_and_row(t_tg *tg, struct _glist *glist,
                        int x, int y, int *col, int *row) {
  int relx = x - text_xpix(&tg->x_obj, glist) - tg->spacing;
  int rely = y - text_ypix(&tg->x_obj, glist) - tg->spacing;
  if (relx < 0 || rely < 0) {
    *row = *col = -1;
    return;
  }

  int fss = tg->cell_size+tg->spacing;
  int rm = relx % fss;
  if (rm > tg->cell_size) {
    *row = *col = -1;
    return;
  }

  rm = rely % fss;
  if (rm > tg->cell_size) {
    *row = *col = -1;
    return;
  }

  *col = relx / fss;
  *row = rely / fss;
}
Пример #24
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); 
        }
    }
}
Пример #25
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);
    }
  }
}
Пример #26
0
/* reset reading speed */
static void scratcher_reset(t_scratcher *x)
{
    t_canvas *canvas=glist_getcanvas(x->x_glist);

    x->x_readspeed=1.;
    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 ))
                 );
    }
}
Пример #27
0
static void pddplink_getrect(t_gobj *z, t_glist *glist,
			     int *xp1, int *yp1, int *xp2, int *yp2)
{
    t_pddplink *x = (t_pddplink *)z;
    int width, height;
    float x1, y1, x2, y2;
    if (glist->gl_editor && glist->gl_editor->e_rtext)
    {
	if (x->x_rtextactive)
	{
	    t_rtext *y = glist_findrtext(glist, (t_text *)x);
	    width = rtext_width(y);
	    height = rtext_height(y) - 2;
	}
	else
	{
	    int font = glist_getfont(glist);
	    width = x->x_vislength * sys_fontwidth(font) + 2;
	    height = sys_fontheight(font) + 2;
	}
    }
    else width = height = 10;
    x1 = text_xpix((t_text *)x, glist);
    y1 = text_ypix((t_text *)x, glist);
    x2 = x1 + width;
    y2 = y1 + height;
    y1 += 1;
    *xp1 = x1;
    *yp1 = y1;
    *xp2 = x2;
    *yp2 = y2;
}
Пример #28
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);
}
Пример #29
0
static void comment_draw(t_comment *x)
{
    char buf[COMMENT_OUTBUFSIZE], *outbuf, *outp;
    unsigned long cvid = (unsigned long)x->x_canvas;
    int reqsize = x->x_textbufsize + 250;  /* FIXME estimation */
    if (reqsize > COMMENT_OUTBUFSIZE)
    {
#ifdef COMMENT_DEBUG
	loudbug_post("allocating %d outbuf bytes", reqsize);
#endif
	if (!(outbuf = getbytes(reqsize)))
	    return;
    }
    else outbuf = buf;
    outp = outbuf;
    sprintf(outp, "comment_draw %s .x%lx.c %s %s %f %f %s %d %s %s {%.*s} %d\n",
	    x->x_bindsym->s_name, cvid, x->x_texttag, x->x_tag,
	    (float)(text_xpix((t_text *)x, x->x_glist) + COMMENT_LMARGIN),
	    (float)(text_ypix((t_text *)x, x->x_glist) + COMMENT_TMARGIN),
	    x->x_fontfamily->s_name, x->x_fontsize,
	    (glist_isselected(x->x_glist, &x->x_glist->gl_gobj) ?
	     "blue" : x->x_color),
	    (x->x_encoding ? x->x_encoding->s_name : "\"\""),
	    x->x_textbufsize, x->x_textbuf, x->x_pixwidth);
    x->x_bbpending = 1;
    sys_gui(outbuf);
    if (outbuf != buf) freebytes(outbuf, reqsize);
}
Пример #30
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);
}