コード例 #1
0
ファイル: scratcher~.c プロジェクト: gdunstone/pd-macambira
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);
}
コード例 #2
0
ファイル: comment.c プロジェクト: amurtet/pd-cyclone
static void comment_dograb(t_comment *x)
{
    /* LATER investigate the grabbing feature.
       Here we use it just to prevent backspace from erasing entire text.
       This has to be done also when we are already active, because
       after being clicked at we have lost our previous grab. */
    glist_grab(x->x_glist, (t_gobj *)x, 0, comment_grabbedkey, 0, 0);
}
コード例 #3
0
ファイル: grid.c プロジェクト: gdunstone/pd-macambira
static int grid_click(t_gobj *z, struct _glist *glist,
                      int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
    t_grid* x = (t_grid *)z;

    // post( "grid_click doit=%d x=%d y=%d", doit, xpix, ypix );
    if ( doit)
    {
        x->x_current = xpix;
        x->y_current = ypix;
        grid_output_current(x);
        grid_draw_update(x, glist);
        glist_grab(glist, &x->x_obj.te_g, (t_glistmotionfn)grid_motion,
                   0, xpix, ypix);
    }
    return (1);
}
コード例 #4
0
ファイル: iem_event.c プロジェクト: Angeldude/pd
static int iem_event_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
  t_iem_event* x = (t_iem_event *)z;
  t_int xpos=text_xpix(&x->x_gui.x_obj, glist);
  t_int ypos=text_ypix(&x->x_gui.x_obj, glist);
  
  if(doit != x->x_doit)
  {
    SETFLOAT(x->x_at_out, (t_float)doit);
    SETFLOAT(x->x_at_out+1, (t_float)shift);
    SETFLOAT(x->x_at_out+2, (t_float)(alt?1:0));
    outlet_anything(x->x_gui.x_obj.ob_outlet, x->x_mouse_shft_alt, 3, x->x_at_out);
    if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
      typedmess(x->x_gui.x_snd->s_thing, x->x_mouse_shft_alt, 3, x->x_at_out);
    if(doit)
      x->x_gui.x_fsf.x_change = 1;
    x->x_doit = doit;
  }
  
  x->x_x = xpix - xpos;
  x->x_y = x->x_gui.x_h - (ypix - ypos);
  SETFLOAT(x->x_at_out, (t_float)x->x_x);
  SETFLOAT(x->x_at_out+1, (t_float)x->x_y);
  if(doit)
  {
    glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
      (t_glistmotionfn)iem_event_motion, iem_event_key, (t_float)xpix, (t_float)ypix);
    
    outlet_anything(x->x_gui.x_obj.ob_outlet, x->x_dragg_x_y, 2, x->x_at_out);
    if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
      typedmess(x->x_gui.x_snd->s_thing, x->x_dragg_x_y, 2, x->x_at_out);
  }
  else
  {
    outlet_anything(x->x_gui.x_obj.ob_outlet, x->x_move_x_y, 2, x->x_at_out);
    if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
      typedmess(x->x_gui.x_snd->s_thing, x->x_move_x_y, 2, x->x_at_out);
  }
  return (1);
}
コード例 #5
0
ファイル: tglgrid.c プロジェクト: nicklan/tglgrid
static int tglgrid_click(t_gobj *z, struct _glist *glist,
                         int xpix, int ypix, int shift,
                         int alt, int dbl, int doit) {
  t_tg* tg = (t_tg *)z;
  int row,col;

  UNUSED(shift);
  UNUSED(alt);
  UNUSED(dbl);

  col_and_row(tg,glist,xpix,ypix,&col,&row);
  if (doit && row>=0) {
    tg->mouse_tgld = do_toggle(tg,row,col);
    tg->tgld_col = col;
    tg->tgld_row = row;
    tg->mouse_x = xpix;
    tg->mouse_y = ypix;
    glist_grab(glist,&tg->x_obj.te_g,
               (t_glistmotionfn)tglgrid_motion,0,xpix,ypix);
  }
  return 1;
}
コード例 #6
0
ファイル: scrolllist.c プロジェクト: Angeldude/pd
static int scrolllist_click(t_gobj *z, struct _glist *glist,
		   int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
 t_scrolllist* x = (t_scrolllist *)z;
 t_canvas *canvas=glist_getcanvas(x->x_glist);
 t_int xoffset;

    if (doit) 
    {
      // deselect previously selected item
      SYS_VGUI5(".x%x.c itemconfigure %xITEM%d -fill %s\n", 
                 canvas, x, x->x_itemselected, x->x_fgcolor); 
      x->x_itemselected = x->x_firstseen + (ypix-text_ypix(&x->x_obj, glist))/x->x_charheight;
      SYS_VGUI5(".x%x.c itemconfigure %xITEM%d -fill %s\n", 
                 canvas, x, x->x_itemselected, x->x_secolor); 
      // post( "scrolllist : selected item : %d", x->x_itemselected );
      if ( x->x_items && ( x->x_itemselected < x->x_nitems ) )
      {
         xoffset=(xpix-text_xpix(&x->x_obj, glist));
         if ( xoffset <= (t_int)( x->x_width*4/5 ) )
         {
           scrolllist_output_current(x);
           scrolllist_erase( x, x->x_glist );
           scrolllist_update( x, glist );
         }
         else
         {
           x->x_itemselected=-1;
         }
      }
      x->x_glist = glist;
      glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)scrolllist_motion,
                  NULL, xpix, ypix ); 
    }
    return (1);
}