[PD-cvs] externals/tkwidgets checkbutton.c, 1.12, 1.13 checkbutton-help.pd, 1.5, 1.6

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Nov 27 07:07:09 CET 2007


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

Modified Files:
	checkbutton.c checkbutton-help.pd 
Log Message:

- added [query id( message to get the Tk ID of the checkbutton widget so
  people can do Tcl madness directly using [sys_gui]


Index: checkbutton.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/checkbutton.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** checkbutton.c	26 Nov 2007 23:38:01 -0000	1.12
--- checkbutton.c	27 Nov 2007 06:07:07 -0000	1.13
***************
*** 22,26 ****
  
  /* TODO rectify char and pixel widths/heights ug */
! /* TODO bind to <Configure> so that things are redrawn when the text changes */
  /* TODO add float method to set state based on == 0 and everything else */
  
--- 22,26 ----
  
  /* TODO rectify char and pixel widths/heights ug */
! /* TODO bind to <Configure> so that things are redrawn when the label changes */
  /* TODO add float method to set state based on == 0 and everything else */
  
***************
*** 103,106 ****
--- 103,112 ----
  };
  
+ /* -------------------- common symbols to preload --------------------------- */
+ 
+ static t_symbol *id_symbol;
+ static t_symbol *query_callback_symbol;
+ static t_symbol *size_symbol;
+ 
  /* -------------------- function prototypes --------------------------------- */
  
***************
*** 151,161 ****
  /* --------------------- query functions ------------------------------------ */
  
  static void query_size(t_checkbutton *x)
  {
      t_atom coords[3];
!     SETSYMBOL(coords, gensym("size"));
      SETFLOAT(coords + 1, (t_float)x->width);
      SETFLOAT(coords + 2, (t_float)x->height);
!     checkbutton_query_callback(x, gensym("query_callback"), 3, coords);
  }
  
--- 157,176 ----
  /* --------------------- query functions ------------------------------------ */
  
+ static void query_id(t_checkbutton *x)
+ {
+     t_atom id[2];
+     t_symbol *widget_id = x->widget_id;
+     SETSYMBOL(id, id_symbol);
+     SETSYMBOL(id + 1, widget_id);
+     checkbutton_query_callback(x, query_callback_symbol, 2, id);
+ }
+ 
  static void query_size(t_checkbutton *x)
  {
      t_atom coords[3];
!     SETSYMBOL(coords, size_symbol);
      SETFLOAT(coords + 1, (t_float)x->width);
      SETFLOAT(coords + 2, (t_float)x->height);
!     checkbutton_query_callback(x, query_callback_symbol, 3, coords);
  }
  
***************
*** 168,174 ****
                                  sizeof(checkbutton_tk_options)/sizeof(char *), 
                                  checkbutton_tk_options);
          query_size(x);
      }
!     else if(s == gensym("size"))
          query_size(x);
      else
--- 183,192 ----
                                  sizeof(checkbutton_tk_options)/sizeof(char *), 
                                  checkbutton_tk_options);
+         query_id(x);
          query_size(x);
      }
!     else if(s == id_symbol)
!         query_id(x);
!     else if(s == size_symbol)
          query_size(x);
      else
***************
*** 434,437 ****
--- 452,460 ----
  	class_addbang(checkbutton_class, (t_method)checkbutton_bang_output);
  	class_addfloat(checkbutton_class, (t_method)checkbutton_float_output);
+ 
+ /* common symbols to preload */
+ 	id_symbol = gensym("id");
+     query_callback_symbol = gensym("query_callback");
+     size_symbol = gensym("size");
      
  /* methods for pd space */
***************
*** 449,453 ****
                      gensym("output"), A_DEFFLOAT, 0);
      class_addmethod(checkbutton_class, (t_method)checkbutton_query_callback,
!                     gensym("query_callback"), A_GIMME, 0);
      class_addmethod(checkbutton_class, (t_method)checkbutton_store_callback,
                      gensym("store_callback"), A_GIMME, 0);
--- 472,476 ----
                      gensym("output"), A_DEFFLOAT, 0);
      class_addmethod(checkbutton_class, (t_method)checkbutton_query_callback,
!                     query_callback_symbol, A_GIMME, 0);
      class_addmethod(checkbutton_class, (t_method)checkbutton_store_callback,
                      gensym("store_callback"), A_GIMME, 0);

Index: checkbutton-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/checkbutton-help.pd,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** checkbutton-help.pd	24 Nov 2007 17:39:44 -0000	1.5
--- checkbutton-help.pd	27 Nov 2007 06:07:07 -0000	1.6
***************
*** 1,28 ****
! #N canvas 13 257 467 404 10;
! #X obj 166 173 checkbutton 90 20;
! #X msg 20 111 query;
! #X obj 263 255 print QUERY;
! #X msg 24 80 query size;
! #X obj 144 168 cnv 15 160 80 empty empty empty 20 12 0 14 -233017 -66577
  0;
! #X obj 69 259 print DATA;
! #X msg 204 144 cursor gumby;
! #X obj 155 262 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
  1;
! #X msg 192 121 text gumby;
! #X msg 159 53 size 90 20;
! #X msg 184 102 text "blah blah";
  #X obj 51 337 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/checkbutton.htm
  ;
! #X msg 141 21 onvalue 5;
! #X msg 347 116 fg blue;
! #X msg 349 138 bg pink;
! #X msg 367 188 anchor w;
! #X msg 116 117 bang;
! #X obj 127 94 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
  1;
! #X msg 125 3 offvalue 3;
! #X msg 172 78 options;
! #X msg 29 140 set 5;
  #X connect 0 0 5 0;
  #X connect 0 0 7 0;
--- 1,28 ----
! #N canvas 12 208 467 404 10;
! #X obj 171 211 checkbutton 90 20;
! #X msg 20 131 query;
! #X obj 263 275 print QUERY;
! #X msg 24 100 query size;
! #X obj 144 188 cnv 15 160 80 empty empty empty 20 12 0 14 -233017 -66577
  0;
! #X obj 69 279 print DATA;
! #X msg 204 164 cursor gumby;
! #X obj 155 282 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
  1;
! #X msg 192 141 text gumby;
! #X msg 159 73 size 90 20;
! #X msg 184 122 text "blah blah";
  #X obj 51 337 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/checkbutton.htm
  ;
! #X msg 141 41 onvalue 5;
! #X msg 347 136 fg blue;
! #X msg 349 158 bg pink;
! #X msg 348 182 anchor w;
! #X msg 116 137 bang;
! #X obj 127 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
  1;
! #X msg 125 23 offvalue 3;
! #X msg 172 98 options;
! #X msg 29 160 set 1;
  #X connect 0 0 5 0;
  #X connect 0 0 7 0;





More information about the Pd-cvs mailing list