[PD-cvs] externals/tkwidgets checkbutton.c, 1.6, 1.7 text.c, 1.13, 1.14

Hans-Christoph Steiner eighthave at users.sourceforge.net
Sat Nov 24 05:51:35 CET 2007


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

Modified Files:
	checkbutton.c text.c 
Log Message:
cleaned up code and made it nice and organized :D

Index: checkbutton.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/checkbutton.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** checkbutton.c	24 Nov 2007 04:07:23 -0000	1.6
--- checkbutton.c	24 Nov 2007 04:51:33 -0000	1.7
***************
*** 114,118 ****
  }
  
! static void checkbutton_drawme(t_checkbutton *x, t_glist *glist)
  {
      set_tkwidgets_ids(x,glist_getcanvas(glist));
--- 114,118 ----
  }
  
! static void drawme(t_checkbutton *x, t_glist *glist)
  {
      set_tkwidgets_ids(x,glist_getcanvas(glist));
***************
*** 133,137 ****
  
  
! static void checkbutton_erase(t_checkbutton* x)
  {
      sys_vgui("destroy %s\n", x->widget_id->s_name);
--- 133,137 ----
  
  
! static void eraseme(t_checkbutton* x)
  {
      sys_vgui("destroy %s\n", x->widget_id->s_name);
***************
*** 203,212 ****
      t_checkbutton* s = (t_checkbutton*)z;
      if (vis)
!         checkbutton_drawme(s, glist);
      else
!         checkbutton_erase(s);
  }
  
! /* --------------------------- methods -------------------------------------- */
  
  static void checkbutton_size(t_checkbutton *x, t_float width, t_float height)
--- 203,223 ----
      t_checkbutton* s = (t_checkbutton*)z;
      if (vis)
!         drawme(s, glist);
      else
!         eraseme(s);
  }
  
! static void checkbutton_save(t_gobj *z, t_binbuf *b)
! {
!     t_checkbutton *x = (t_checkbutton *)z;
!     binbuf_addv(b, "ssiisii", &s__X, gensym("obj"),
!                 x->x_obj.te_xpix, x->x_obj.te_ypix, 
!                 atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
!                 x->width, x->height);
! // TODO    binbuf_addbinbuf(b, x->options_binbuf);
!     binbuf_addv(b, ";");
! }
! 
! /* --------------------------- methods for pd space ------------------------- */
  
  static void checkbutton_size(t_checkbutton *x, t_float width, t_float height)
***************
*** 250,258 ****
      t_checkbutton *x = (t_checkbutton *)pd_new(checkbutton_class);
  
!     x->x_glist = (t_glist*) canvas_getcurrent();
  
      x->width = 15;
      x->height = 15;
  
      x->tcl_namespace = tkwidgets_gen_tcl_namespace((t_object*)x, s);
      x->receive_name = tkwidgets_gen_callback_name(x->tcl_namespace);
--- 261,273 ----
      t_checkbutton *x = (t_checkbutton *)pd_new(checkbutton_class);
  
!     x->options_binbuf = binbuf_new();
  
      x->width = 15;
      x->height = 15;
  
+     if(argc > 0) x->width = atom_getint(argv);
+     if(argc > 1) x->height = atom_getint(argv + 1);
+     if(argc > 2) binbuf_add(x->options_binbuf, argc - 2, argv + 2);
+ 
      x->tcl_namespace = tkwidgets_gen_tcl_namespace((t_object*)x, s);
      x->receive_name = tkwidgets_gen_callback_name(x->tcl_namespace);
***************
*** 271,278 ****
  void checkbutton_setup(void)
  {
!     checkbutton_class = class_new(gensym("checkbutton"), (t_newmethod)checkbutton_new, 
!                             (t_method)checkbutton_free, 
!                             sizeof(t_checkbutton), 0, A_GIMME,0);
! 
      class_addmethod(checkbutton_class, (t_method)checkbutton_query,
                      gensym("query"), A_DEFSYMBOL, 0);
--- 286,295 ----
  void checkbutton_setup(void)
  {
!     checkbutton_class = class_new(gensym("checkbutton"), 
!                                   (t_newmethod)checkbutton_new, 
!                                   (t_method)checkbutton_free, 
!                                   sizeof(t_checkbutton), 0, A_GIMME,0);
!     
! /* methods for pd space */
      class_addmethod(checkbutton_class, (t_method)checkbutton_query,
                      gensym("query"), A_DEFSYMBOL, 0);
***************
*** 284,287 ****
--- 301,305 ----
                      gensym("query_callback"), A_GIMME, 0);
  
+ /* widget behavior */
      checkbutton_widgetbehavior.w_getrectfn  = checkbutton_getrect;
      checkbutton_widgetbehavior.w_displacefn = checkbutton_displace;
***************
*** 292,295 ****
--- 310,314 ----
      checkbutton_widgetbehavior.w_clickfn    = NULL;
      class_setwidget(checkbutton_class, &checkbutton_widgetbehavior);
+     class_setsavefn(checkbutton_class, &checkbutton_save);
  }
  

Index: text.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/text.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** text.c	24 Nov 2007 04:07:23 -0000	1.13
--- text.c	24 Nov 2007 04:51:33 -0000	1.14
***************
*** 132,135 ****
--- 132,152 ----
  /* -------------------- widget helper functions ----------------------------- */
  
+ static void query_scrollbars(t_textwidget *x)
+ {
+     t_atom state[2];
+     SETSYMBOL(state, scrollbars_symbol);
+     SETFLOAT(state + 1, (t_float)x->have_scrollbars);
+     textwidget_query_callback(x, gensym("query_callback"), 2, state);
+ }
+ 
+ static void query_size(t_textwidget *x)
+ {
+     t_atom coords[3];
+     SETSYMBOL(coords, size_symbol);
+     SETFLOAT(coords + 1, (t_float)x->width);
+     SETFLOAT(coords + 2, (t_float)x->height);
+     textwidget_query_callback(x, gensym("query_callback"), 3, coords);
+ }
+ 
  static void set_tkwidgets_ids(t_textwidget *x, t_canvas *canvas)
  {
***************
*** 180,186 ****
  }
  
! static void textwidget_drawme(t_textwidget *x, t_glist *glist)
  {
!     DEBUG(post("textwidget_drawme: firsttime %d canvas %lx glist %lx", x->x_canvas, glist););
      set_tkwidgets_ids(x,glist_getcanvas(glist));	
      create_widget(x);	
--- 197,203 ----
  }
  
! static void drawme(t_textwidget *x, t_glist *glist)
  {
!     DEBUG(post("drawme: firsttime %d canvas %lx glist %lx", x->x_canvas, glist););
      set_tkwidgets_ids(x,glist_getcanvas(glist));	
      create_widget(x);	
***************
*** 197,203 ****
  }     
  
! static void textwidget_erase(t_textwidget* x)
  {
!     DEBUG(post("textwidget_erase: canvas %lx", x->x_canvas););
      tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
      sys_vgui("destroy %s\n", x->frame_id->s_name);
--- 214,220 ----
  }     
  
! static void eraseme(t_textwidget* x)
  {
!     DEBUG(post("eraseme: canvas %lx", x->x_canvas););
      tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
      sys_vgui("destroy %s\n", x->frame_id->s_name);
***************
*** 303,328 ****
      t_textwidget *x = (t_textwidget*)z;
      DEBUG(post("textwidget_vis: vis %d canvas %lx glist %lx", vis, x->x_canvas, glist););
!     t_rtext *y;
!     if (vis) {
!         y = (t_rtext *) rtext_new(glist, (t_text *)z);
!         textwidget_drawme(x, glist);
!     }
!     else {
!         y = glist_findrtext(glist, (t_text *)z);
!         textwidget_erase(x);
!         rtext_free(y);
!     }
  }
  
! /*  the clickfn is only called in run mode
  static int textwidget_click(t_gobj *z, t_glist *glist, int xpix, int ypix, 
                         int shift, int alt, int dbl, int doit)
  {
      t_textwidget *x = (t_textwidget *)z;
!     DEBUG(post("textwidget_click x:%d y:%d edit: %d", xpix, ypix, x->x_canvas->gl_edit););    
      return 0;
  }
  */
  
  static void textwidget_append(t_textwidget* x,  t_symbol *s, int argc, t_atom *argv)
  {
--- 320,392 ----
      t_textwidget *x = (t_textwidget*)z;
      DEBUG(post("textwidget_vis: vis %d canvas %lx glist %lx", vis, x->x_canvas, glist););
!     if (vis)
!         drawme(x, glist);
!     else 
!         eraseme(x);
  }
  
! /*  the clickfn is only called in run mode and is therefore not useful AFAIK
!  *  for this text widget, unless there is something like click to output words
!  *  implemented, which is what Max/MSP's textedit does */
! /*
  static int textwidget_click(t_gobj *z, t_glist *glist, int xpix, int ypix, 
                         int shift, int alt, int dbl, int doit)
  {
      t_textwidget *x = (t_textwidget *)z;
!     DEBUG(post("textwidget_click x:%d y:%d edit: %d", xpix, ypix, x->x_canvas->gl_edit););
      return 0;
  }
  */
  
+ static void textwidget_save(t_gobj *z, t_binbuf *b)
+ {
+     t_textwidget *x = (t_textwidget *)z;
+     
+     binbuf_addv(b, "ssiisiii", &s__X, gensym("obj"),
+                 x->x_obj.te_xpix, x->x_obj.te_ypix, 
+                 atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
+                 x->width, x->height, x->have_scrollbars);
+     binbuf_addbinbuf(b, x->options_binbuf);
+     binbuf_addv(b, ";");
+ }
+ 
+ 
+ /* -------------------- methods for atoms ----------------------------------- */
+ 
+ /* this function uses the selector as the Tk option and applies the whole
+  * message directly to the Tk widget itself using Tk's "configure".  This
+  * function is called when "anything" is received. */
+ static void textwidget_set_option(t_textwidget *x, t_symbol *s, int argc, t_atom *argv)
+ {
+     if(s != &s_list)
+     {
+         t_binbuf *argument_binbuf = binbuf_new();
+         char *argument_buffer;
+         int buffer_length;
+         
+         binbuf_add(argument_binbuf, argc, argv);
+         binbuf_gettext(argument_binbuf, &argument_buffer, &buffer_length);
+         binbuf_free(argument_binbuf);
+         argument_buffer[buffer_length] = 0;
+         sys_vgui("%s configure -%s {%s} \n", 
+                  x->widget_id->s_name, s->s_name, argument_buffer);
+         tkwidgets_store_options(x->receive_name, x->tcl_namespace, x->widget_id, 
+                                 sizeof(textwidget_tk_options)/sizeof(char *), 
+                                 (char **)&textwidget_tk_options);
+     }
+ }
+ 
+ /* Pass the contents of the text widget onto the textwidget_output_callback
+  * fuction above */
+ static void textwidget_bang_output(t_textwidget* x)
+ {
+     /* With "," and ";" escaping thanks to JMZ */
+     sys_vgui("pd [concat %s output [string map {\",\" \"\\\\,\" \";\" \"\\\\;\"} \
+               [%s get 0.0 end]] \\;]\n", 
+              x->receive_name->s_name, x->widget_id->s_name);
+ }
+ 
+ /* -------------------- methods for pd space -------------------------------- */
+ 
  static void textwidget_append(t_textwidget* x,  t_symbol *s, int argc, t_atom *argv)
  {
***************
*** 351,354 ****
--- 415,424 ----
  }
  
+ /* Clear the contents of the text widget */
+ static void textwidget_clear(t_textwidget* x)
+ {
+     sys_vgui("%s delete 0.0 end \n", x->widget_id->s_name);
+ }
+ 
  static void textwidget_key(t_textwidget* x,  t_symbol *s, int argc, t_atom *argv)
  {
***************
*** 381,390 ****
  }
  
- /* Clear the contents of the text widget */
- static void textwidget_clear(t_textwidget* x)
- {
-     sys_vgui("%s delete 0.0 end \n", x->widget_id->s_name);
- }
- 
  /* Function to reset the contents of the textwidget box */
  static void textwidget_set(t_textwidget* x,  t_symbol *s, int argc, t_atom *argv)
--- 451,454 ----
***************
*** 396,411 ****
  }
  
! /* Pass the contents of the text widget onto the textwidget_output_callback fuction above */
! static void textwidget_bang_output(t_textwidget* x)
  {
!     /* With "," and ";" escaping thanks to JMZ */
!     sys_vgui("pd [concat %s output [string map {\",\" \"\\\\,\" \";\" \"\\\\;\"} \
!               [%s get 0.0 end]] \\;]\n", 
!              x->receive_name->s_name, x->widget_id->s_name);
  }
  
! static void textwidget_output_callback(t_textwidget* x, t_symbol *s, int argc, t_atom *argv)
  {
!     outlet_list(x->x_data_outlet, s, argc, argv );
  }
  
--- 460,523 ----
  }
  
! static void textwidget_options(t_textwidget *x)
  {
!     tkwidgets_list_options(x->x_status_outlet,
!                            sizeof(textwidget_tk_options)/sizeof(char *), 
!                            (char **)&textwidget_tk_options);
  }
  
! static void textwidget_query(t_textwidget *x, t_symbol *s)
  {
!     post("textwidget_query %s", s->s_name);
!     if(s == &s_)
!     {
!         tkwidgets_query_options(x->receive_name, x->widget_id, 
!                                 sizeof(textwidget_tk_options)/sizeof(char *), 
!                                 textwidget_tk_options);
!         query_scrollbars(x);
!         query_size(x);
!     }
!     else if(s == scrollbars_symbol)
!         query_scrollbars(x);
!     else if(s == size_symbol)
!         query_size(x);
!     else
!         tkwidgets_query_options(x->receive_name, x->widget_id, 1, &(s->s_name));
! }
! 
! static void textwidget_scrollbars(t_textwidget *x, t_float f)
! {
!     int value = (int) f;
!     if(value > 0)
!         draw_scrollbar(x);
!     else
!         erase_scrollbar(x);
! }
! 
! static void textwidget_size(t_textwidget *x, t_float width, t_float height)
! {
!     DEBUG(post("textwidget_size"););
!     x->height = height;
!     x->width = width;
!     if(glist_isvisible(x->x_glist))
!     {
!         sys_vgui("%s itemconfigure %s -width %d -height %d\n",
!                  x->canvas_id->s_name, x->window_tag->s_name, x->width, x->height);
!         tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
!         tkwidgets_draw_iolets((t_object*)x, x->x_glist, 
!                               x->canvas_id, x->iolets_tag, x->all_tag,
!                               x->width, x->height);
!         canvas_fixlinesfor(x->x_glist, (t_text *)x);  // 2nd inlet
!     }
! }
! 
! /* -------------------- callback functions ---------------------------------- */
! 
! static void textwidget_click_callback(t_textwidget *x, t_floatarg f)
! {
!     if( (x->x_glist->gl_edit) && (x->x_glist == x->x_canvas) )
!     {	
!         textwidget_select((t_gobj *)x, x->x_glist, f);
!     }
  }
  
***************
*** 422,426 ****
          output_symbol = gensym(buf);
      } else
!         switch(keycode)
          {
          case 32: /* space */
--- 534,538 ----
          output_symbol = gensym(buf);
      } else
!         switch(keycode) /* TODO find a way to make this work with all keysyms */
          {
          case 32: /* space */
***************
*** 459,567 ****
  }
  
! static void textwidget_save(t_gobj *z, t_binbuf *b)
! {
!     t_textwidget *x = (t_textwidget *)z;
!     
!     binbuf_addv(b, "ssiisiii", &s__X, gensym("obj"),
!                 x->x_obj.te_xpix, x->x_obj.te_ypix, 
!                 atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
!                 x->width, x->height, x->have_scrollbars);
!     binbuf_addbinbuf(b, x->options_binbuf);
!     binbuf_addv(b, ";");
! }
! 
! /* this function uses the selector as the Tk option and applies the whole
!  * message directly to the Tk widget itself using Tk's "configure" */
! static void textwidget_set_option(t_textwidget *x, t_symbol *s, int argc, t_atom *argv)
! {
!     if(s != &s_list)
!     {
!         t_binbuf *argument_binbuf = binbuf_new();
!         char *argument_buffer;
!         int buffer_length;
!         
!         binbuf_add(argument_binbuf, argc, argv);
!         binbuf_gettext(argument_binbuf, &argument_buffer, &buffer_length);
!         binbuf_free(argument_binbuf);
!         argument_buffer[buffer_length] = 0;
!         sys_vgui("%s configure -%s {%s} \n", 
!                  x->widget_id->s_name, s->s_name, argument_buffer);
!         tkwidgets_store_options(x->receive_name, x->tcl_namespace, x->widget_id, 
!                                 sizeof(textwidget_tk_options)/sizeof(char *), 
!                                 (char **)&textwidget_tk_options);
!     }
! }
! 
! static void textwidget_options(t_textwidget *x)
! {
!     tkwidgets_list_options(x->x_status_outlet,
!                            sizeof(textwidget_tk_options)/sizeof(char *), 
!                            (char **)&textwidget_tk_options);
! }
! 
! static void query_scrollbars(t_textwidget *x)
! {
!     t_atom state[2];
!     SETSYMBOL(state, scrollbars_symbol);
!     SETFLOAT(state + 1, (t_float)x->have_scrollbars);
!     textwidget_query_callback(x, gensym("query_callback"), 2, state);
! }
! 
! static void query_size(t_textwidget *x)
! {
!     t_atom coords[3];
!     SETSYMBOL(coords, size_symbol);
!     SETFLOAT(coords + 1, (t_float)x->width);
!     SETFLOAT(coords + 2, (t_float)x->height);
!     textwidget_query_callback(x, gensym("query_callback"), 3, coords);
! }
! 
! static void textwidget_query(t_textwidget *x, t_symbol *s)
  {
!     post("textwidget_query %s", s->s_name);
!     if(s == &s_)
!     {
!         tkwidgets_query_options(x->receive_name, x->widget_id, 
!                                 sizeof(textwidget_tk_options)/sizeof(char *), 
!                                 textwidget_tk_options);
!         query_scrollbars(x);
!         query_size(x);
!     }
!     else if(s == scrollbars_symbol)
!         query_scrollbars(x);
!     else if(s == size_symbol)
!         query_size(x);
!     else
!         tkwidgets_query_options(x->receive_name, x->widget_id, 1, &(s->s_name));
  }
  
! static void textwidget_scrollbars(t_textwidget *x, t_float f)
  {
!     int value = (int) f;
!     if(value > 0)
!         draw_scrollbar(x);
      else
!         erase_scrollbar(x);
! }
! 
! static void textwidget_size(t_textwidget *x, t_float width, t_float height)
! {
!     DEBUG(post("textwidget_size"););
!     x->height = height;
!     x->width = width;
!     if(glist_isvisible(x->x_glist))
!     {
!         sys_vgui("%s itemconfigure %s -width %d -height %d\n",
!                  x->canvas_id->s_name, x->window_tag->s_name, x->width, x->height);
!         tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
!         tkwidgets_draw_iolets((t_object*)x, x->x_glist, 
!                               x->canvas_id, x->iolets_tag, x->all_tag,
!                               x->width, x->height);
!         canvas_fixlinesfor(x->x_glist, (t_text *)x);  // 2nd inlet
!     }
  }
  
- /* -------------------- callback functions ---------------------------------- */
- 
  static void textwidget_store_callback(t_textwidget *x, t_symbol *s, int argc, t_atom *argv)
  {
--- 571,588 ----
  }
  
! static void textwidget_output_callback(t_textwidget* x, t_symbol *s, int argc, t_atom *argv)
  {
!     outlet_list(x->x_data_outlet, s, argc, argv );
  }
  
! static void textwidget_query_callback(t_textwidget *x, t_symbol *s, int argc, t_atom *argv)
  {
!     t_symbol *tmp_symbol = atom_getsymbolarg(0, argc, argv);
!     if(tmp_symbol != &s_)
!         outlet_anything(x->x_status_outlet, tmp_symbol, argc - 1, argv + 1);
      else
!         post("ERROR: textwidget_query_callback %s %d", s->s_name, argc);
  }
  
  static void textwidget_store_callback(t_textwidget *x, t_symbol *s, int argc, t_atom *argv)
  {
***************
*** 575,605 ****
  }
  
- static void textwidget_query_callback(t_textwidget *x, t_symbol *s, int argc, t_atom *argv)
- {
-     t_symbol *tmp_symbol = atom_getsymbolarg(0, argc, argv);
-     if(tmp_symbol != &s_)
-     {
-         post("tmp_symbol %s argc %d", tmp_symbol->s_name, argc);
-         outlet_anything(x->x_status_outlet, tmp_symbol, argc - 1, argv + 1);
-     }
-     else
-     {
-         post("ERROR: textwidget_query_callback %s %d", s->s_name, argc);
-     }
- }
- 
- static void textwidget_click_callback(t_textwidget *x, t_floatarg f)
- {
-     if( (x->x_glist->gl_edit) && (x->x_glist == x->x_canvas) )
-     {	
-         textwidget_select((t_gobj *)x, x->x_glist, f);
-     }
- }
- 
  static void textwidget_resize_click_callback(t_textwidget *x, t_floatarg f)
  {
      t_canvas *canvas = (glist_isvisible(x->x_glist) ? x->x_canvas : 0);
      int button_state = (int)f;
!     if (x->x_resizing && !button_state && canvas)
      {
          tkwidgets_draw_iolets((t_object*)x, canvas,
--- 596,604 ----
  }
  
  static void textwidget_resize_click_callback(t_textwidget *x, t_floatarg f)
  {
      t_canvas *canvas = (glist_isvisible(x->x_glist) ? x->x_canvas : 0);
      int button_state = (int)f;
!     if(x->x_resizing && !button_state && canvas)
      {
          tkwidgets_draw_iolets((t_object*)x, canvas,
***************
*** 608,612 ****
          canvas_fixlinesfor(x->x_glist, (t_text *)x);  // 2nd inlet
      }
!     if (!x->x_resizing && button_state)
      {
          tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
--- 607,611 ----
          canvas_fixlinesfor(x->x_glist, (t_text *)x);  // 2nd inlet
      }
!     else if(!x->x_resizing && button_state)
      {
          tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
***************
*** 651,671 ****
      x->x_selected = 0;
      x->x_resizing = 0;
! 	
! 	if (argc < 3)
! 	{
! 		post("[text]: less than 3 arguments entered, default values used.");
! 		x->width = TEXT_DEFAULT_WIDTH;
! 		x->height = TEXT_DEFAULT_HEIGHT;
!         x->have_scrollbars = 0;
! 	} 
!     else 
!     {
! 		x->width = atom_getint(argv);
! 		x->height = atom_getint(argv + 1);
!         x->have_scrollbars = atom_getint(argv + 2);
!         if(argc > 3) 
!             binbuf_add(x->options_binbuf, argc - 3, argv + 3);
! 	}	
  
      x->tcl_namespace = tkwidgets_gen_tcl_namespace((t_object*)x, s);
      x->receive_name = tkwidgets_gen_callback_name(x->tcl_namespace);
--- 650,662 ----
      x->x_selected = 0;
      x->x_resizing = 0;
!     x->width = TEXT_DEFAULT_WIDTH;
!     x->height = TEXT_DEFAULT_HEIGHT;
!     x->have_scrollbars = 0;
  
+     if(argc > 0) x->width = atom_getint(argv);
+     if(argc > 1) x->height = atom_getint(argv + 1);
+     if(argc > 2) x->have_scrollbars = atom_getint(argv + 2);
+     if(argc > 3) binbuf_add(x->options_binbuf, argc - 3, argv + 3);
+     
      x->tcl_namespace = tkwidgets_gen_tcl_namespace((t_object*)x, s);
      x->receive_name = tkwidgets_gen_callback_name(x->tcl_namespace);
***************
*** 687,694 ****
                                   (t_method)textwidget_free,sizeof(t_textwidget),
                                   0, A_GIMME, 0);
! 				
  	class_addbang(textwidget_class, (t_method)textwidget_bang_output);
  	class_addanything(textwidget_class, (t_method)textwidget_set_option);
  
  	class_addmethod(textwidget_class, (t_method)textwidget_append,
                      gensym("append"), A_GIMME, 0);
--- 678,687 ----
                                   (t_method)textwidget_free,sizeof(t_textwidget),
                                   0, A_GIMME, 0);
! 
! /* methods for atoms */
  	class_addbang(textwidget_class, (t_method)textwidget_bang_output);
  	class_addanything(textwidget_class, (t_method)textwidget_set_option);
  
+ /* methods for pd space */
  	class_addmethod(textwidget_class, (t_method)textwidget_append,
                      gensym("append"), A_GIMME, 0);
***************
*** 709,722 ****
  
  /* callbacks */
-     class_addmethod(textwidget_class, (t_method)textwidget_store_callback,
-                     gensym("store_callback"), A_GIMME, 0);
-     class_addmethod(textwidget_class, (t_method)textwidget_query_callback,
-                     gensym("query_callback"), A_GIMME, 0);
- 	class_addmethod(textwidget_class, (t_method)textwidget_output_callback,
-                     gensym("output"), A_GIMME, 0);
-     class_addmethod(textwidget_class, (t_method)textwidget_keyup_callback,
-                     gensym("keyup"), A_DEFFLOAT, 0);
      class_addmethod(textwidget_class, (t_method)textwidget_click_callback,
                      gensym("click"), A_FLOAT, 0);
      class_addmethod(textwidget_class, (t_method)textwidget_resize_click_callback,
                      gensym("resize_click"), A_FLOAT, 0);
--- 702,715 ----
  
  /* callbacks */
      class_addmethod(textwidget_class, (t_method)textwidget_click_callback,
                      gensym("click"), A_FLOAT, 0);
+     class_addmethod(textwidget_class, (t_method)textwidget_keyup_callback,
+                     gensym("keyup"), A_DEFFLOAT, 0);
+ 	class_addmethod(textwidget_class, (t_method)textwidget_output_callback,
+                     gensym("output"), A_GIMME, 0);
+     class_addmethod(textwidget_class, (t_method)textwidget_query_callback,
+                     gensym("query_callback"), A_GIMME, 0);
+     class_addmethod(textwidget_class, (t_method)textwidget_store_callback,
+                     gensym("store_callback"), A_GIMME, 0);
      class_addmethod(textwidget_class, (t_method)textwidget_resize_click_callback,
                      gensym("resize_click"), A_FLOAT, 0);
***************
*** 724,727 ****
--- 717,721 ----
                      gensym("resize_motion"), A_FLOAT, A_FLOAT, 0);
  
+ /* widget behavior */
      textwidget_widgetbehavior.w_getrectfn  = textwidget_getrect;
      textwidget_widgetbehavior.w_displacefn = textwidget_displace;
***************
*** 731,736 ****
      textwidget_widgetbehavior.w_visfn      = textwidget_vis;
      textwidget_widgetbehavior.w_clickfn    = NULL;
!     class_setwidget(textwidget_class,&textwidget_widgetbehavior);
!     class_setsavefn(textwidget_class,&textwidget_save);
  
  /* commonly used symbols */
--- 725,730 ----
      textwidget_widgetbehavior.w_visfn      = textwidget_vis;
      textwidget_widgetbehavior.w_clickfn    = NULL;
!     class_setwidget(textwidget_class, &textwidget_widgetbehavior);
!     class_setsavefn(textwidget_class, &textwidget_save);
  
  /* commonly used symbols */
***************
*** 747,750 ****
  	down_symbol = gensym("down");
  }
- 
- 
--- 741,742 ----





More information about the Pd-cvs mailing list