[PD-cvs] pd/src g_bang.c,1.1.1.3.2.2.2.17,1.1.1.3.2.2.2.18 g_hslider.c,1.1.1.3.2.2.2.17,1.1.1.3.2.2.2.18 g_hdial.c,1.1.1.4.2.2.2.15,1.1.1.4.2.2.2.16 g_toggle.c,1.1.1.3.2.2.2.13,1.1.1.3.2.2.2.14 u_object.tk,1.1.2.30,1.1.2.31 u_main.tk,1.1.1.4.2.7.4.54,1.1.1.4.2.7.4.55

Mathieu Bouchard matju at users.sourceforge.net
Mon May 3 04:51:48 CEST 2004


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4876

Modified Files:
      Tag: impd_0_37
	g_bang.c g_hslider.c g_hdial.c g_toggle.c u_object.tk 
	u_main.tk 
Log Message:
bang,toggle,radios,sliders' event handling moved to Tcl


Index: g_toggle.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_toggle.c,v
retrieving revision 1.1.1.3.2.2.2.13
retrieving revision 1.1.1.3.2.2.2.14
diff -C2 -d -r1.1.1.3.2.2.2.13 -r1.1.1.3.2.2.2.14
*** g_toggle.c	1 May 2004 15:38:35 -0000	1.1.1.3.2.2.2.13
--- g_toggle.c	3 May 2004 02:51:44 -0000	1.1.1.3.2.2.2.14
***************
*** 41,46 ****
  {
      t_toggle *x = (t_toggle *)z;
!     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
!     *yp1 = text_ypix(&x->x_gui.x_obj, glist);
      *xp2 = *xp1 + x->x_gui.x_w;
      *yp2 = *yp1 + x->x_gui.x_h;
--- 41,46 ----
  {
      t_toggle *x = (t_toggle *)z;
!     *xp1 = text_xpix((t_text *)x, glist);
!     *yp1 = text_ypix((t_text *)x, glist);
      *xp2 = *xp1 + x->x_gui.x_w;
      *yp2 = *yp1 + x->x_gui.x_h;
***************
*** 112,155 ****
  }
  
- static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
- {toggle_bang(x);}
- 
- static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
- {
-     if(doit)
- 	toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
-     return (1);
- }
- 
  static void toggle_set(t_toggle *x, t_floatarg f)
  {
      x->x_on = f;
!     if(f != 0.0)
! 	x->x_nonzero = f;
      x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
  }
  
  static void toggle_float(t_toggle *x, t_floatarg f)
! {
!     toggle_set(x, f);
!     if(x->x_gui.x_put_in2out) toggle_action(x);
! }
  
  static void toggle_fout(t_toggle *x, t_floatarg f)
! {
!     toggle_set(x, f);
!     toggle_action(x);
! }
  
  static void toggle_loadbang(t_toggle *x)
! {
!     if(!sys_noloadbang && x->x_gui.x_loadinit)
! 	toggle_fout(x, (float)x->x_on);
! }
  
  static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av)
  {
!     x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
!     x->x_gui.x_h = x->x_gui.x_w;
      iemgui_size((t_iemgui *)x);
  }
--- 112,134 ----
  }
  
  static void toggle_set(t_toggle *x, t_floatarg f)
  {
      x->x_on = f;
!     if(f != 0.0) x->x_nonzero = f;
      x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
  }
  
  static void toggle_float(t_toggle *x, t_floatarg f)
! {toggle_set(x, f); if(x->x_gui.x_put_in2out) toggle_action(x);}
  
  static void toggle_fout(t_toggle *x, t_floatarg f)
! {toggle_set(x, f); toggle_action(x);}
  
  static void toggle_loadbang(t_toggle *x)
! {if(!sys_noloadbang && x->x_gui.x_loadinit) toggle_fout(x, (float)x->x_on);}
  
  static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av)
  {
!     x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
      iemgui_size((t_iemgui *)x);
  }
***************
*** 178,182 ****
  	nonzero = (float)atom_getfloatarg(13, argc, argv);
      x->x_gui.x_draw = (t_iemfunptr)toggle_draw;
-     x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
      x->x_gui.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
      x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
--- 157,160 ----
***************
*** 186,190 ****
      if (x->x_gui.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
      x->x_gui.x_fontsize = MAX(fs,4);
-     x->x_gui.x_fontsize = fs;
      x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a);
      iemgui_all_colfromload(&x->x_gui, bflcol);
--- 164,167 ----
***************
*** 194,201 ****
  }
  
! static void toggle_ff(t_toggle *x)
  {
!     if(x->x_gui.x_rcv_able)
! 	pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
      gfxstub_deleteforkey(x);
  }
--- 171,177 ----
  }
  
! static void toggle_free(t_toggle *x)
  {
!     if(x->x_gui.x_rcv_able) pd_unbind((t_pd *)x, x->x_gui.x_rcv);
      gfxstub_deleteforkey(x);
  }
***************
*** 205,216 ****
  {
      t_class *c = toggle_class = class_new(gensym("tgl"), (t_newmethod)toggle_new,
! 			     (t_method)toggle_ff, sizeof(t_toggle), 0, A_GIMME, 0);
      class_addcreator((t_newmethod)toggle_new, gensym("toggle"), A_GIMME, 0);
      class_addbang(c, toggle_bang);
      class_addfloat(c, toggle_float);
!     class_addmethod(c, (t_method)toggle_click, gensym("click"),
! 		    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
!     class_addmethod(c, (t_method)toggle_dialog, gensym("dialog"),
! 		    A_GIMME, 0);
      class_addmethod(c, (t_method)toggle_loadbang, gensym("loadbang"), 0);
      class_addmethod(c, (t_method)toggle_set, gensym("set"), A_FLOAT, 0);
--- 181,189 ----
  {
      t_class *c = toggle_class = class_new(gensym("tgl"), (t_newmethod)toggle_new,
! 			     (t_method)toggle_free, sizeof(t_toggle), 0, A_GIMME, 0);
      class_addcreator((t_newmethod)toggle_new, gensym("toggle"), A_GIMME, 0);
      class_addbang(c, toggle_bang);
      class_addfloat(c, toggle_float);
!     class_addmethod(c, (t_method)toggle_dialog, gensym("dialog"), A_GIMME, 0);
      class_addmethod(c, (t_method)toggle_loadbang, gensym("loadbang"), 0);
      class_addmethod(c, (t_method)toggle_set, gensym("set"), A_FLOAT, 0);
***************
*** 224,231 ****
      wb.w_displacefn = iemgui_displace;
      wb.w_selectfn = iemgui_select;
!     wb.w_activatefn = NULL;
      wb.w_deletefn = iemgui_delete;
      wb.w_visfn = iemgui_vis;
!     wb.w_clickfn = toggle_newclick;
      class_setwidget(c, &wb);
      class_sethelpsymbol(c, gensym("toggle"));
--- 197,204 ----
      wb.w_displacefn = iemgui_displace;
      wb.w_selectfn = iemgui_select;
!     wb.w_activatefn = 0;
      wb.w_deletefn = iemgui_delete;
      wb.w_visfn = iemgui_vis;
!     wb.w_clickfn = 0;
      class_setwidget(c, &wb);
      class_sethelpsymbol(c, gensym("toggle"));

Index: g_hdial.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v
retrieving revision 1.1.1.4.2.2.2.15
retrieving revision 1.1.1.4.2.2.2.16
diff -C2 -d -r1.1.1.4.2.2.2.15 -r1.1.1.4.2.2.2.16
*** g_hdial.c	3 May 2004 00:40:48 -0000	1.1.1.4.2.2.2.15
--- g_hdial.c	3 May 2004 02:51:44 -0000	1.1.1.4.2.2.2.16
***************
*** 21,25 ****
  #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
  
! #define IEM_RADIO_MAX   128
  
  static t_class *radio_class;
--- 21,25 ----
  #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
  
! #define IEM_RADIO_MAX 128
  
  static t_class *radio_class;
***************
*** 50,56 ****
  {
      t_hradio *x = (t_hradio *)z;
! 
!     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
!     *yp1 = text_ypix(&x->x_gui.x_obj, glist);
      *xp2 = *xp1 + x->x_gui.x_w*(isvert(x)?1:x->x_number);
      *yp2 = *yp1 + x->x_gui.x_h*(isvert(x)?x->x_number:1);
--- 50,55 ----
  {
      t_hradio *x = (t_hradio *)z;
!     *xp1 = text_xpix((t_text *)x, glist);
!     *yp1 = text_ypix((t_text *)x, glist);
      *xp2 = *xp1 + x->x_gui.x_w*(isvert(x)?1:x->x_number);
      *yp2 = *yp1 + x->x_gui.x_h*(isvert(x)?x->x_number:1);
***************
*** 80,84 ****
      char buf[800];
      t_symbol *srl[3];
- 
      iemgui_properties(&x->x_gui, srl);
      sprintf(buf, "pdtk_iemgui_dialog %%s hradio \
--- 79,82 ----
***************
*** 102,118 ****
      int chg = (int)atom_getintarg(4, argc, argv);
      int num = (int)atom_getintarg(6, argc, argv);
! 
!     if(chg != 0) chg = 1;
!     x->x_change = chg;
      iemgui_dialog(&x->x_gui, srl, argc, argv);
!     x->x_gui.x_w = iemgui_clip_size(a);
!     x->x_gui.x_h = x->x_gui.x_w;
!     if(x->x_number != num)
!     {
  	x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
  	x->x_number = num;
! 	if(x->x_on >= x->x_number)
! 	{
! 	    x->x_on = x->x_number - 1;
  	    x->x_on_old = x->x_on;
  	}
--- 100,111 ----
      int chg = (int)atom_getintarg(4, argc, argv);
      int num = (int)atom_getintarg(6, argc, argv);
!     x->x_change = !!chg;
      iemgui_dialog(&x->x_gui, srl, argc, argv);
!     x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a);
!     if(x->x_number != num) {
  	x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
  	x->x_number = num;
! 	if(x->x_on >= x->x_number) {
! 	    x->x_on = x->x_number-1;
  	    x->x_on_old = x->x_on;
  	}
***************
*** 126,140 ****
      int i=(int)f;
      int old=x->x_on_old;
- 
      CLAMP(i,0,x->x_number-1);
!     if(x->x_on != x->x_on_old)
!     {
  	x->x_on_old = x->x_on;
  	x->x_on = i;
  	x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
  	x->x_on_old = old;
!     }
!     else
!     {
  	x->x_on = i;
  	x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
--- 119,129 ----
      int i=(int)f;
      int old=x->x_on_old;
      CLAMP(i,0,x->x_number-1);
!     if(x->x_on != x->x_on_old) {
  	x->x_on_old = x->x_on;
  	x->x_on = i;
  	x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
  	x->x_on_old = old;
!     } else {
  	x->x_on = i;
  	x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
***************
*** 197,201 ****
      else
      {
!     	outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i);
  	if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
  	    pd_float(x->x_gui.x_snd->s_thing, x->x_on);
--- 186,191 ----
      else
      {
! 	x->x_on = i;
!     	outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
  	if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
  	    pd_float(x->x_gui.x_snd->s_thing, x->x_on);
***************
*** 213,220 ****
      {
  	/* compatibility with earlier "vdial" behavior */
! 	if (x->x_change && i!=x->x_on_old)
! 	{
! 	    if(x->x_gui.x_put_in2out)
! 	    {
          	SETFLOAT(x->x_at, (float)x->x_on_old);
  		SETFLOAT(x->x_at+1, 0.0);
--- 203,207 ----
      {
  	/* compatibility with earlier "vdial" behavior */
! 	if (x->x_change && i!=x->x_on_old && x->x_gui.x_put_in2out) {
          	SETFLOAT(x->x_at, (float)x->x_on_old);
  		SETFLOAT(x->x_at+1, 0.0);
***************
*** 222,226 ****
  		if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
  		    pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
- 	    }
  	}
  	x->x_on_old = x->x_on;
--- 209,212 ----
***************
*** 251,277 ****
  }
  
- static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos,
-     t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
- {
-     int val = isvert(x) ?
- 	((int)ypos - (int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist))/x->x_gui.x_h :
- 	((int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))/x->x_gui.x_h;
-     hradio_fout(x, (float)val);
- }
- 
- static int hradio_newclick(t_gobj *z, struct _glist *glist,
-     int xpix, int ypix, int shift, int alt, int dbl, int doit)
- {
-     if(doit)
- 	hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
- 	    (t_floatarg)shift, 0, (t_floatarg)alt);
-     return (1);
- }
- 
  static void hradio_loadbang(t_hradio *x)
! {
!     if(!sys_noloadbang && x->x_gui.x_loadinit)
! 	hradio_bang(x);
! }
  
  static void hradio_number(t_hradio *x, t_floatarg num)
--- 237,242 ----
  }
  
  static void hradio_loadbang(t_hradio *x)
! {if(!sys_noloadbang && x->x_gui.x_loadinit) hradio_bang(x);}
  
  static void hradio_number(t_hradio *x, t_floatarg num)
***************
*** 279,285 ****
      int n=(int)num;
      CLAMP(n,1,IEM_RADIO_MAX);
!     if(n != x->x_number)
!     {
! 	(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
  	x->x_number = n;
  	CLAMP(x->x_on,0,x->x_number-1);
--- 244,249 ----
      int n=(int)num;
      CLAMP(n,1,IEM_RADIO_MAX);
!     if(n != x->x_number) {
! 	x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
  	x->x_number = n;
  	CLAMP(x->x_on,0,x->x_number-1);
***************
*** 355,359 ****
      class_addbang(c, hradio_bang);
      class_addfloat(c, hradio_float);
-     class_addmethod(c, (t_method)hradio_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
      class_addmethod(c, (t_method)hradio_dialog, gensym("dialog"), A_GIMME, 0);
      class_addmethod(c, (t_method)hradio_loadbang, gensym("loadbang"), 0);
--- 319,322 ----
***************
*** 361,364 ****
--- 324,328 ----
      class_addmethod(c, (t_method)hradio_size, gensym("size"), A_GIMME, 0);
      class_addmethod(c, (t_method)hradio_init, gensym("init"), A_FLOAT, 0);
+     class_addmethod(c, (t_method)hradio_fout, gensym("fout"), A_FLOAT, 0);
      class_addmethod(c, (t_method)hradio_number, gensym("number"), A_FLOAT, 0);
      class_addmethod(c, (t_method)hradio_single_change, gensym("single_change"), 0);
***************
*** 369,376 ****
      wb.w_displacefn = iemgui_displace;
      wb.w_selectfn = iemgui_select;
!     wb.w_activatefn = NULL;
      wb.w_deletefn = iemgui_delete;
      wb.w_visfn = iemgui_vis;
!     wb.w_clickfn = hradio_newclick;
  
      sym_hdl    = gensym("hdl");
--- 333,340 ----
      wb.w_displacefn = iemgui_displace;
      wb.w_selectfn = iemgui_select;
!     wb.w_activatefn = 0;
      wb.w_deletefn = iemgui_delete;
      wb.w_visfn = iemgui_vis;
!     wb.w_clickfn = 0 /*hradio_newclick*/;
  
      sym_hdl    = gensym("hdl");

Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.54
retrieving revision 1.1.1.4.2.7.4.55
diff -C2 -d -r1.1.1.4.2.7.4.54 -r1.1.1.4.2.7.4.55
*** u_main.tk	1 May 2004 17:41:29 -0000	1.1.1.4.2.7.4.54
--- u_main.tk	3 May 2004 02:51:45 -0000	1.1.1.4.2.7.4.55
***************
*** 781,786 ****
      bind $name.c <Shift-Key>  {pdtk_canvas_key %W %K %A 1}
      bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
!     bind $name.c <Motion>     {pdtk_canvas_motion %W %x %y 0}
!     bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4}
      bind $name.c <Map>        {pdtk_canvas_map %W}
      bind $name.c <Unmap>      {pdtk_canvas_unmap %W}
--- 781,786 ----
      bind $name.c <Shift-Key>  {pdtk_canvas_key %W %K %A 1}
      bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
!     bind $name.c <Motion>     {pdtk_canvas_motion %W %x %y 0 %s}
!     bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4 %s}
      bind $name.c <Map>        {pdtk_canvas_map %W}
      bind $name.c <Unmap>      {pdtk_canvas_unmap %W}
***************
*** 862,866 ****
  
  proc pdtk_canvas_click2 {canvas x y b f} {
!     global _ wire_from
      set self [canvastosym $canvas]
      set cx [$canvas canvasx $x]
--- 862,866 ----
  
  proc pdtk_canvas_click2 {canvas x y b f} {
!     global _ wire_from rightclick_object
      set self [canvastosym $canvas]
      set cx [$canvas canvasx $x]
***************
*** 871,878 ****
        object {
          set run [expr !$edit || ($f&2)]
- 	puts "$self click-on-object x$id $cx $cy $b $f;"
  	pd "$self click-on-object x$id $cx $cy $b $f;"
  	if {$f&8} {
  	    puts "RIGHTCLICK OBJECT"
  	} elseif {$run && [info exists _($id:clickevent)]} {
  		eval [linsert [list $id $canvas $cx $cy $b $f] 0 $_($id:clickevent)]
--- 871,878 ----
        object {
          set run [expr !$edit || ($f&2)]
  	pd "$self click-on-object x$id $cx $cy $b $f;"
  	if {$f&8} {
  	    puts "RIGHTCLICK OBJECT"
+ 	    set rightclick_object $id
  	} elseif {$run && [info exists _($id:clickevent)]} {
  		eval [linsert [list $id $canvas $cx $cy $b $f] 0 $_($id:clickevent)]
***************
*** 932,941 ****
  set wire_to {}
  
! proc pdtk_canvas_motion {canvas x y mods} {
!     pdtk_canvas_motion2 $canvas $x $y $mods
      statusbar_update [string trimright $canvas .c] $x $y
  }
  
! proc pdtk_canvas_motion2 {canvas x y mods} {
      global current_x current_y old_x old_y
      global tooltip _ dehighlight look wire_from wire_to
--- 932,941 ----
  set wire_to {}
  
! proc pdtk_canvas_motion {canvas x y mods state} {
!     pdtk_canvas_motion2 $canvas $x $y $mods $state
      statusbar_update [string trimright $canvas .c] $x $y
  }
  
! proc pdtk_canvas_motion2 {canvas x y mods state} {
      global current_x current_y old_x old_y
      global tooltip _ dehighlight look wire_from wire_to
***************
*** 986,990 ****
      switch $type {
        object {
-         puts $mods
          set run [expr !$edit]
          if {$run && [info exists _($id:motionevent)]} {
--- 986,989 ----
***************
*** 1058,1062 ****
      if {[llength $wire_from]} {
          if {[llength $wire_to]} {
- 		puts stderr "$self add-wire x$wire_from x$wire_to ;"
  		pd "$self add-wire x$wire_from x$wire_to ;"
  	}
--- 1057,1060 ----
***************
*** 1076,1081 ****
      }
      if {[llength $_($self:selection)]==1} {
! 	pd   "$self gobj-activate x$_($self:selection);"
      }
      pd "$self mouseup $cx $cy $b ;"
  
--- 1074,1093 ----
      }
      if {[llength $_($self:selection)]==1} {
! 	pd "$self gobj-activate x$_($self:selection);"
      }
+     
+     set edit 0; switch $_($self:mode) { edit { set edit 1 } }
+     foreach {type id} [identify_target $canvas $cx $cy -1 -1 "blah "] {}
+     switch $type {
+       object {
+         set run [expr !$edit]
+         if {$run && [info exists _($id:unclickevent)]} {
+ 		eval [linsert [list $id $canvas $cx $cy] 0 $_($id:unclickevent)]
+         } elseif {!$run && [info exists _($id:unclickeditevent)]} {
+ 		eval [linsert [list $id $canvas $cx $cy] 0 $_($id:unclickeditevent)]
+ 	}
+       }
+     }
+     
      pd "$self mouseup $cx $cy $b ;"
  
***************
*** 1439,1443 ****
  
  proc popup_action {name action} {
!     global popup_xpix popup_ypix
      pd "$name done-popup $action $popup_xpix $popup_ypix ;"
  }
--- 1451,1460 ----
  
  proc popup_action {name action} {
!     global popup_xpix popup_ypix rightclick_object
!     switch -- $action {
!       0 {}
!       1 {}
!       2 {}
!     }
      pd "$name done-popup $action $popup_xpix $popup_ypix ;"
  }

Index: g_hslider.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v
retrieving revision 1.1.1.3.2.2.2.17
retrieving revision 1.1.1.3.2.2.2.18
diff -C2 -d -r1.1.1.3.2.2.2.17 -r1.1.1.3.2.2.2.18
*** g_hslider.c	1 May 2004 15:38:35 -0000	1.1.1.3.2.2.2.17
--- g_hslider.c	3 May 2004 02:51:44 -0000	1.1.1.3.2.2.2.18
***************
*** 53,63 ****
  /* ------------------------ hsl widgetbehaviour----------------------------- */
  
! static void hslider_getrect(t_gobj *z, t_glist *glist,
! 			    int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_hslider* x = (t_hslider*)z;
! 
!     *xp1 = text_xpix(&x->x_gui.x_obj, glist) - (isvert(x)?0:3);
!     *yp1 = text_ypix(&x->x_gui.x_obj, glist) - (isvert(x)?2:0);
      *xp2 = *xp1 + x->x_gui.x_w + (isvert(x)?0:5);
      *yp2 = *yp1 + x->x_gui.x_h + (isvert(x)?5:0);
--- 53,61 ----
  /* ------------------------ hsl widgetbehaviour----------------------------- */
  
! static void hslider_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_hslider* x = (t_hslider*)z;
!     *xp1 = text_xpix((t_text *)x, glist) - (isvert(x)?0:3);
!     *yp1 = text_ypix((t_text *)x, glist) - (isvert(x)?2:0);
      *xp2 = *xp1 + x->x_gui.x_w + (isvert(x)?0:5);
      *yp2 = *yp1 + x->x_gui.x_h + (isvert(x)?5:0);
***************
*** 85,96 ****
  {
      double l = (double)(isvert(x) ? x->x_gui.x_h : x->x_gui.x_w)-1;
!     int m = isvert(x) ? x->x_gui.x_h*100 - 100 : x->x_gui.x_w*100 - 100;
      double span = x->x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max - x->x_min);
      if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE;
!     if (isvert(x)) {
! 	x->x_gui.x_h = w;
!     } else {
! 	x->x_gui.x_w = w;
!     }
      if(x->x_val > m) {x->x_pos = m; x->x_val = x->x_pos;}
      x->x_k = span/l;
--- 83,90 ----
  {
      double l = (double)(isvert(x) ? x->x_gui.x_h : x->x_gui.x_w)-1;
!     int m = l*100;
      double span = x->x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max - x->x_min);
      if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE;
!     if (isvert(x)) {x->x_gui.x_h=w;} else {x->x_gui.x_w=w;}
      if(x->x_val > m) {x->x_pos = m; x->x_val = x->x_pos;}
      x->x_k = span/l;
***************
*** 122,136 ****
      iemgui_properties(&x->x_gui, srl);
      sprintf(buf, "pdtk_iemgui_dialog %%s HSLIDER \
! 	    --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \
! 	    -----------output-range:----------- %g left: %g right: %g \
! 	    %d lin log %d %d empty %d \
! 	    %s %s %s %d %d %d %d %d %d %d\n",
! 	    x->x_gui.x_w, IEM_SL_MINSIZE, x->x_gui.x_h, IEM_GUI_MINSIZE,
! 	    x->x_min, x->x_max, 0.0,/*no_schedule*/
! 	    x->x_lin0_log1, x->x_gui.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/
! 	    srl[0]->s_name, srl[1]->s_name,
! 	    srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
! 	    x->x_gui.x_font_style, x->x_gui.x_fontsize,
! 	    0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
      gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
  }
--- 116,128 ----
      iemgui_properties(&x->x_gui, srl);
      sprintf(buf, "pdtk_iemgui_dialog %%s HSLIDER \
! 	--------dimensions(pix)(pix):-------- %d %d width: %d %d height: \
! 	-----------output-range:----------- %g left: %g right: %g \
! 	%d lin log %d %d empty %d \
! 	%s %s %s %d %d %d %d %d %d %d\n",
! 	x->x_gui.x_w, IEM_SL_MINSIZE, x->x_gui.x_h, IEM_GUI_MINSIZE,
! 	x->x_min, x->x_max, 0.0, x->x_lin0_log1, x->x_gui.x_loadinit,
! 	x->x_steady, -1, srl[0]->s_name, srl[1]->s_name, srl[2]->s_name,
! 	x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_font_style, x->x_gui.x_fontsize,
! 	0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
      gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
  }
***************
*** 198,232 ****
  }
  
- static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos,
- 			  t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
- {
-     int max = isvert(x) ? 100*x->x_gui.x_h-100 : 100*x->x_gui.x_w-100;
-     if(!x->x_steady) {
- 	int l = isvert(x) ?
- 	    x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos :
- 	    xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
- 	x->x_val = (int)(100.0*l);
-     }
-     CLAMP(x->x_val,0,max);
-     x->x_pos = x->x_val;
-     x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
-     hslider_bang(x);
-     glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)hslider_motion,
- 	       0, xpos, ypos);
- }
- 
- static int hslider_newclick(t_gobj *z, struct _glist *glist,
- 			    int xpix, int ypix, int shift, int alt, int dbl, int doit)
- {
-     t_hslider* x = (t_hslider *)z;
-     if(doit)
-     {
- 	hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
- 		       0, (t_floatarg)alt);
- 	x->x_gui.x_finemoved = !!shift;
-     }
-     return (1);
- }
- 
  static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av)
  {
--- 190,193 ----
***************
*** 234,267 ****
      x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
      if(ac > 1) hslider_check_width(x, (int)atom_getintarg(1, ac, av));
-     iemgui_size((t_iemgui *)x);
  }else{
      hslider_check_width(x, (int)atom_getintarg(0, ac, av));
      if(ac > 1) x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av));
      iemgui_size((t_iemgui *)x);
! }}
  
  static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av)
  {
!     hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
! 			 (double)atom_getfloatarg(1, ac, av));
  }
  
  static void hslider_log(t_hslider *x)
! {
!     x->x_lin0_log1 = 1;
!     hslider_check_minmax(x, x->x_min, x->x_max);
! }
! 
  static void hslider_lin(t_hslider *x)
! {
!     x->x_lin0_log1 = 0;
!     x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); /*!@#$ what about x_h? */
! }
! 
! static void hslider_init(t_hslider *x, t_floatarg f)
! {x->x_gui.x_loadinit = (f==0.0)?0:1;}
  
! static void hslider_steady(t_hslider *x, t_floatarg f)
! {x->x_steady = (f==0.0)?0:1;}
  
  static void hslider_float(t_hslider *x, t_floatarg f)
--- 195,219 ----
      x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
      if(ac > 1) hslider_check_width(x, (int)atom_getintarg(1, ac, av));
  }else{
      hslider_check_width(x, (int)atom_getintarg(0, ac, av));
      if(ac > 1) x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av));
+ }
      iemgui_size((t_iemgui *)x);
! }
  
  static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av)
  {
!     hslider_check_minmax(x,
! 	(double)atom_getfloatarg(0, ac, av),
! 	(double)atom_getfloatarg(1, ac, av));
  }
  
  static void hslider_log(t_hslider *x)
! {x->x_lin0_log1 = 1; hslider_check_minmax(x, x->x_min, x->x_max);}
  static void hslider_lin(t_hslider *x)
! {x->x_lin0_log1 = 0; x->x_k = (x->x_max-x->x_min)/(double)((isvert(x)?x->x_gui.x_h:x->x_gui.x_w) - 1);}
  
! static void hslider_init(t_hslider *x, t_floatarg f) {x->x_gui.x_loadinit = !!f;}
! static void hslider_steady(t_hslider *x, t_floatarg f) {x->x_steady = !!f;}
  
  static void hslider_float(t_hslider *x, t_floatarg f)
***************
*** 318,322 ****
      if((argc == 18)&&IS_A_FLOAT(argv,17)) steady=!!(int)atom_getintarg(17,argc,argv);
      x->x_gui.x_draw = (t_iemfunptr)hslider_draw;
-     x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
      x->x_val = x->x_gui.x_loadinit ? v : 0;
      x->x_pos = x->x_val;
--- 270,273 ----
***************
*** 326,330 ****
      x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
      iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style);
!     if(x->x_gui.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
      x->x_gui.x_ldx = ldx;
      x->x_gui.x_ldy = ldy;
--- 277,281 ----
      x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
      iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style);
!     if(x->x_gui.x_rcv_able) pd_bind((t_pd *)x, x->x_gui.x_rcv);
      x->x_gui.x_ldx = ldx;
      x->x_gui.x_ldy = ldy;
***************
*** 341,346 ****
  static void hslider_free(t_hslider *x)
  {
!     if(x->x_gui.x_rcv_able)
! 	pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
      gfxstub_deleteforkey(x);
  }
--- 292,296 ----
  static void hslider_free(t_hslider *x)
  {
!     if(x->x_gui.x_rcv_able) pd_unbind((t_pd *)x, x->x_gui.x_rcv);
      gfxstub_deleteforkey(x);
  }
***************
*** 349,353 ****
      class_addbang(c,hslider_bang);
      class_addfloat(c,hslider_float);
-     class_addmethod(c, (t_method)hslider_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
      class_addmethod(c, (t_method)hslider_motion, gensym("motion"), A_FLOAT, A_FLOAT, 0);
      class_addmethod(c, (t_method)hslider_dialog, gensym("dialog"), A_GIMME, 0);
--- 299,302 ----
***************
*** 366,372 ****
  {
      hslider_class = class_new(gensym("hsl"), (t_newmethod)hslider_new,
! 			      (t_method)hslider_free, sizeof(t_hslider), 0, A_GIMME, 0);
      vslider_class = class_new(gensym("vsl"), (t_newmethod)hslider_new,
! 			      (t_method)hslider_free, sizeof(t_hslider), 0, A_GIMME, 0);
  #ifndef GGEE_HSLIDER_COMPATIBLE
      class_addcreator((t_newmethod)hslider_new, gensym("hslider"), A_GIMME, 0);
--- 315,321 ----
  {
      hslider_class = class_new(gensym("hsl"), (t_newmethod)hslider_new,
! 	(t_method)hslider_free, sizeof(t_hslider), 0, A_GIMME, 0);
      vslider_class = class_new(gensym("vsl"), (t_newmethod)hslider_new,
! 	(t_method)hslider_free, sizeof(t_hslider), 0, A_GIMME, 0);
  #ifndef GGEE_HSLIDER_COMPATIBLE
      class_addcreator((t_newmethod)hslider_new, gensym("hslider"), A_GIMME, 0);
***************
*** 382,386 ****
      wb.w_deletefn =   iemgui_delete;
      wb.w_visfn =      iemgui_vis;
!     wb.w_clickfn =    hslider_newclick;
  
      class_setwidget(hslider_class, &wb);
--- 331,335 ----
      wb.w_deletefn =   iemgui_delete;
      wb.w_visfn =      iemgui_vis;
!     wb.w_clickfn =    0;
  
      class_setwidget(hslider_class, &wb);

Index: g_bang.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_bang.c,v
retrieving revision 1.1.1.3.2.2.2.17
retrieving revision 1.1.1.3.2.2.2.18
diff -C2 -d -r1.1.1.3.2.2.2.17 -r1.1.1.3.2.2.2.18
*** g_bang.c	1 May 2004 15:38:35 -0000	1.1.1.3.2.2.2.17
--- g_bang.c	3 May 2004 02:51:42 -0000	1.1.1.3.2.2.2.18
***************
*** 51,55 ****
      int bflcol[3];
      t_symbol *srl[3];
- 
      iemgui_save(&x->x_gui, srl, bflcol);
      binbuf_addv(b, "ssiisiiiisssiiiiiii", gensym("#X"),gensym("obj"),
--- 51,54 ----
***************
*** 151,164 ****
  }
  
- static void bng_click(t_bng *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
- {bng_set(x); bng_bout2(x);}
- 
- static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
- {
-     if(doit)
- 	bng_click((t_bng *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
-     return 1;
- }
- 
  static void bng_float(t_bng *x, t_floatarg f)     {bng_bang2(x);}
  static void bng_symbol(t_bng *x, t_symbol *s)     {bng_bang2(x);}
--- 150,153 ----
***************
*** 205,215 ****
      iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]);
      x->x_gui.x_draw = (t_iemfunptr)bng_draw;
-     x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
      x->x_flashed = 0;
      x->x_gui.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
      x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
      iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style);
!     if (x->x_gui.x_rcv_able)
! 	pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
      x->x_gui.x_fontsize = MAX(fs,4);
      x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a);
--- 194,202 ----
      iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]);
      x->x_gui.x_draw = (t_iemfunptr)bng_draw;
      x->x_flashed = 0;
      x->x_gui.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
      x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
      iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style);
!     if (x->x_gui.x_rcv_able) pd_bind((t_pd *)x, x->x_gui.x_rcv);
      x->x_gui.x_fontsize = MAX(fs,4);
      x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a);
***************
*** 222,229 ****
      x->x_clock_lck = clock_new(x, (t_method)bng_tick_lck);
      outlet_new(&x->x_gui.x_obj, &s_bang);
!     return (x);
  }
  
! static void bng_ff(t_bng *x)
  {
      if(x->x_gui.x_rcv_able)
--- 209,216 ----
      x->x_clock_lck = clock_new(x, (t_method)bng_tick_lck);
      outlet_new(&x->x_gui.x_obj, &s_bang);
!     return x;
  }
  
! static void bng_free(t_bng *x)
  {
      if(x->x_gui.x_rcv_able)
***************
*** 239,243 ****
  {
      t_class *c = bng_class = class_new(gensym("bng"), (t_newmethod)bng_new,
! 	(t_method)bng_ff, sizeof(t_bng), 0, A_GIMME, 0);
      class_addbang(c, bng_bang);
      class_addfloat(c, bng_float);
--- 226,230 ----
  {
      t_class *c = bng_class = class_new(gensym("bng"), (t_newmethod)bng_new,
! 	(t_method)bng_free, sizeof(t_bng), 0, A_GIMME, 0);
      class_addbang(c, bng_bang);
      class_addfloat(c, bng_float);
***************
*** 246,251 ****
      class_addlist(c, bng_list);
      class_addanything(c, bng_anything);
-     class_addmethod(c, (t_method)bng_click, gensym("click"),
- 		    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
      class_addmethod(c, (t_method)bng_dialog, gensym("dialog"), A_GIMME, 0);
      class_addmethod(c, (t_method)bng_loadbang, gensym("loadbang"), 0);
--- 233,236 ----
***************
*** 257,264 ****
      wb.w_displacefn = iemgui_displace;
      wb.w_selectfn = iemgui_select;
!     wb.w_activatefn = NULL;
      wb.w_deletefn = iemgui_delete;
      wb.w_visfn = iemgui_vis;
!     wb.w_clickfn = bng_newclick;
      class_setwidget(bng_class, &wb);
      class_sethelpsymbol(bng_class, gensym("bng"));
--- 242,249 ----
      wb.w_displacefn = iemgui_displace;
      wb.w_selectfn = iemgui_select;
!     wb.w_activatefn = 0;
      wb.w_deletefn = iemgui_delete;
      wb.w_visfn = iemgui_vis;
!     wb.w_clickfn = 0;
      class_setwidget(bng_class, &wb);
      class_sethelpsymbol(bng_class, gensym("bng"));

Index: u_object.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v
retrieving revision 1.1.2.30
retrieving revision 1.1.2.31
diff -C2 -d -r1.1.2.30 -r1.1.2.31
*** u_object.tk	1 May 2004 15:24:01 -0000	1.1.2.30
--- u_object.tk	3 May 2004 02:51:44 -0000	1.1.2.31
***************
*** 473,483 ****
  }
  
! proc radio_draw {self canvas} {
  	global _
- 	set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
  	switch $_($self:class) {
  		hradio {set orient 0} hdl {set orient 0}
  		vradio {set orient 1} vdl {set orient 1}
  	}
  	foreach {x1 y1} [object_xy $self $canvas] {}
  	set n $_($self:n)
--- 473,490 ----
  }
  
! proc radio_orient {self} {
  	global _
  	switch $_($self:class) {
  		hradio {set orient 0} hdl {set orient 0}
  		vradio {set orient 1} vdl {set orient 1}
+ 		default {set orient 0}
  	}
+ 	return $orient
+ }
+ 
+ proc radio_draw {self canvas} {
+ 	global _
+ 	set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
+ 	set orient [radio_orient $self]
  	foreach {x1 y1} [object_xy $self $canvas] {}
  	set n $_($self:n)
***************
*** 505,508 ****
--- 512,516 ----
  	}
  	label_draw $self $canvas
+ 	set _($self:clickevent) radio_click
  }
  
***************
*** 521,524 ****
--- 529,541 ----
  }
  
+ proc radio_click {self canvas x y b f} {
+ 	global _
+ 	set x [expr $x-$_($self:x1)]
+ 	set y [expr $y-$_($self:y1)]
+ 	set orient [radio_orient $self]
+ 	set i [expr ($orient?$y:$x)/$_($self:w)]
+ 	pd "x$self fout $i ;"
+ }
+ 
  proc clamp {x min max} {
  	if {$x<$min} {return $min}
***************
*** 527,530 ****
--- 544,555 ----
  }
  
+ proc slider_orient {self} {
+ 	global _
+ 	switch $_($self:class) {
+ 		vsl {set orient 1} default {set orient 0}
+ 	}
+ 	return $orient
+ }
+ 
  proc slider_draw {self canvas} {
  	set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
***************
*** 533,539 ****
  	set xs $_($self:w)
  	set ys $_($self:h)
! 	switch $_($self:class) {
! 		hsl { set orient 0 }
! 		vsl { set orient 1 }}
  	if {$orient} {set y1 [expr $y1-2]} {set x1 [expr $x1-2]}
  	if {$orient} {set ys [expr $ys+5]} {set xs [expr $xs+5]}
--- 558,562 ----
  	set xs $_($self:w)
  	set ys $_($self:h)
! 	set orient [slider_orient $self]
  	if {$orient} {set y1 [expr $y1-2]} {set x1 [expr $x1-2]}
  	if {$orient} {set ys [expr $ys+5]} {set xs [expr $xs+5]}
***************
*** 542,545 ****
--- 565,569 ----
  	switch $_($self:class) {hsl {set orient 0} vsl {set orient 1}}
  	bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs
+ 	if {![info exists _($self:clicking)]} {set _($self:clicking) 0}
  	if {$isnew} {
  		set color [bluify #ffffff]
***************
*** 548,551 ****
--- 572,578 ----
  	}
  	label_draw $self $canvas
+ 	set _($self:clickevent)   slider_click
+ 	set _($self:motionevent)  slider_motion
+ 	set _($self:unclickevent) slider_unclick
  	return
  	#EXPERIMENTAL: (notches)
***************
*** 571,577 ****
  	set pos [$canvas coords ${self}BASE]
  	foreach {x1 y1} [object_xy $self $canvas] {}
! 	switch $_($self:class) {
! 		hsl { set orient 0 }
! 		vsl { set orient 1 }}
  	if {$orient} {
  		set size [expr [lindex $pos 2]-$x1]
--- 598,604 ----
  	set pos [$canvas coords ${self}BASE]
  	foreach {x1 y1} [object_xy $self $canvas] {}
! 	set orient [slider_orient $self]
! 	set span [expr $_($self:max)-$_($self:min)]
! 	set _($self:value) [expr $value*$span/($orient?$_($self:h):$_($self:w))/100]
  	if {$orient} {
  		set size [expr [lindex $pos 2]-$x1]
***************
*** 601,604 ****
--- 628,655 ----
  }
  
+ proc slider_click {self canvas x y b f} {
+ 	global _
+ 	set _($self:clicking) 1
+ 	set _($self:last) [list $x $y]
+ }
+ 
+ proc slider_unclick {self canvas x y} {
+ 	global _
+ 	set _($self:clicking) 0
+ }
+ 
+ proc slider_motion {self canvas x y mods} {
+ 	global _
+ 	if {!$_($self:clicking)} {return}
+ 	set dx [expr $x-[lindex $_($self:last) 0]]
+ 	set dy [expr $y-[lindex $_($self:last) 1]]
+ 	set orient [slider_orient $self]
+ 	set span [expr $_($self:max)-$_($self:min)]
+ 	set d [expr ($orient?-$dy:$dx)*$span/($orient?$_($self:h):$_($self:w))]
+ 	set _($self:value) [expr $_($self:value)+$d]
+ 	pd "x$self float $_($self:value) ;"
+ 	set _($self:last) [list $x $y]
+ }
+ 
  proc label_draw {self canvas} {
  	global _
***************
*** 647,650 ****
--- 698,702 ----
  	}
  	label_draw $self $canvas
+ 	set _($self:clickevent) bang_click
  }
  
***************
*** 659,662 ****
--- 711,718 ----
  }
  
+ proc bang_click {self canvas x y b f} {
+ 	pd "x$self click $x $y 0 0 0 ;"
+ }
+ 
  proc bang_bang {self canvas} {
  	global _
***************
*** 672,676 ****
  	set x2 [expr $x1+$xs]
  	set y2 [expr $y1+$ys]
! 	set ins  [expr [string compare $_($self:snd) empty]==0]
  	set outs [expr [string compare $_($self:snd) empty]==0]
  	set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
--- 728,732 ----
  	set x2 [expr $x1+$xs]
  	set y2 [expr $y1+$ys]
! 	set ins  [expr [string compare $_($self:rcv) empty]==0]
  	set outs [expr [string compare $_($self:snd) empty]==0]
  	set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
***************
*** 695,698 ****
--- 751,756 ----
  	label_draw $self $canvas
  	toggle_set $self $canvas $_($self:on)
+ 	
+ 	set _($self:clickevent) toggle_click
  }
  
***************
*** 718,721 ****
--- 776,783 ----
  }
  
+ proc toggle_click {self canvas x y b f} {
+ 	pd "x$self bang ;"
+ }
+ 
  set vu_col {
      0 17 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 





More information about the Pd-cvs mailing list