[PD-cvs] externals/tkwidgets/shared tkwidgets.c, 1.7, 1.8 tkwidgets.h, 1.7, 1.8

Hans-Christoph Steiner eighthave at users.sourceforge.net
Fri Nov 23 23:44:05 CET 2007


Update of /cvsroot/pure-data/externals/tkwidgets/shared
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26612/shared

Modified Files:
	tkwidgets.c tkwidgets.h 
Log Message:

- fixed bug that caused the iolets to multiply whenever resizing, I forgot to
  add the ->s_name to a symbol used in the sys_vgui, so it was using the
  pointer value.

- moved standard key/mouse binding functions to tkwidgets.[ch]

- minor code cleanups for legibility


Index: tkwidgets.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/shared/tkwidgets.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tkwidgets.c	22 Nov 2007 05:57:45 -0000	1.7
--- tkwidgets.c	23 Nov 2007 22:44:03 -0000	1.8
***************
*** 188,192 ****
  void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag)
  {
!     sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag); 
  }
  
--- 188,244 ----
  void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag)
  {
!     sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag->s_name); 
! }
! 
! 
! /* -------------------- bind to keys and mouse events ----------------------- */
! 
! void tkwidgets_bind_key_events(t_symbol *canvas_id, t_symbol *widget_id)
! {
! #ifdef __APPLE__
!     sys_vgui("bind %s <Mod1-Key> {pdtk_canvas_ctrlkey %s %%K 0}\n",
!              widget_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <Mod1-Shift-Key> {pdtk_canvas_ctrlkey %s %%K 1}\n",
!              widget_id->s_name, canvas_id->s_name);
! #else
!     sys_vgui("bind %s <Control-Key> {pdtk_canvas_ctrlkey %s %%K 0}\n",
!              widget_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <Control-Shift-Key> {pdtk_canvas_ctrlkey %s %%K 1}\n",
!              widget_id->s_name, canvas_id->s_name);
! #endif
! }
! 
! void tkwidgets_bind_mouse_events(t_symbol *canvas_id, t_symbol *widget_id)
! {
!     /* mouse buttons */
!     sys_vgui("bind %s <Button> {pdtk_canvas_sendclick %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] %%b 0}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <ButtonRelease> {pdtk_canvas_mouseup %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] %%b}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <Shift-Button> {pdtk_canvas_click %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] %%b 1}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <Button-2> {pdtk_canvas_rightclick %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] %%b}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <Button-3> {pdtk_canvas_rightclick %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] %%b}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
!     sys_vgui("bind %s <Control-Button> {pdtk_canvas_rightclick %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] %%b}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
!     /* mouse motion */
!     sys_vgui("bind %s <Motion> {pdtk_canvas_motion %s \
! [expr %%X - [winfo rootx %s]] [expr %%Y - [winfo rooty %s]] 0}\n",
!              widget_id->s_name, canvas_id->s_name, 
!              canvas_id->s_name, canvas_id->s_name);
  }
  

Index: tkwidgets.h
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/shared/tkwidgets.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tkwidgets.h	22 Nov 2007 05:57:45 -0000	1.7
--- tkwidgets.h	23 Nov 2007 22:44:03 -0000	1.8
***************
*** 101,107 ****
  void tkwidgets_draw_resize_window(); // TODO draw the resize window while resizing
  
! 
! 
! 
  
  
--- 101,109 ----
  void tkwidgets_draw_resize_window(); // TODO draw the resize window while resizing
  
! /* bind this widget to Cmd/Ctrl keys and mouse events to support things like
!  * then standard keys and right-click to bring up the Properties/Open/Help
!  * menu when the Tk widgets have focus */
! void tkwidgets_bind_key_events(t_symbol *canvas_id, t_symbol *widget_id);
! void tkwidgets_bind_mouse_events(t_symbol *canvas_id, t_symbol *widget_id);
  
  





More information about the Pd-cvs mailing list