[PD-cvs] pd/src desire.c,1.1.2.8,1.1.2.9

Mathieu Bouchard matju at users.sourceforge.net
Sun Sep 11 22:33:11 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
removed more dead code (incl [messageresponder])


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** desire.c	10 Sep 2005 08:25:35 -0000	1.1.2.8
--- desire.c	11 Sep 2005 20:33:09 -0000	1.1.2.9
***************
*** 327,371 ****
  /* ---------------------- the "message" text item ------------------------ */
  
! typedef struct _messresponder
! {
      t_pd mr_pd;
      t_outlet *mr_outlet;
! } t_messresponder;
  
! typedef struct _message
! {
      t_text m_text;
!     t_messresponder m_messresponder;
      t_glist *m_glist;
-     t_clock *m_clock;
  } t_message;
  
! static t_class *message_class, *messresponder_class;
! 
! static void messresponder_bang(t_messresponder *x)
! {outlet_bang(x->mr_outlet);}
! static void messresponder_float(t_messresponder *x, t_float f)
! {outlet_float(x->mr_outlet, f);}
! static void messresponder_symbol(t_messresponder *x, t_symbol *s)
! {outlet_symbol(x->mr_outlet, s);}
! static void messresponder_list(t_messresponder *x, t_symbol *s, int argc, t_atom *argv)
! {outlet_list(x->mr_outlet, s, argc, argv);}
! static void messresponder_anything(t_messresponder *x, t_symbol *s, int argc, t_atom *argv)
! {outlet_anything(x->mr_outlet, s, argc, argv);}
  
  static void message_bang(t_message *x)
! {binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, 0, 0);}
  static void message_float(t_message *x, t_float f) {
      t_atom at;
      SETFLOAT(&at, f);
!     binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, 1, &at);
  }
  static void message_symbol(t_message *x, t_symbol *s) {
      t_atom at;
      SETSYMBOL(&at, s);
!     binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, 1, &at);
  }
  static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, argc, argv);}
  
  static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
--- 327,357 ----
  /* ---------------------- the "message" text item ------------------------ */
  
! typedef struct {
      t_pd mr_pd;
      t_outlet *mr_outlet;
! } t_mresp;
  
! typedef struct {
      t_text m_text;
!     t_mresp m_mresp;
      t_glist *m_glist;
  } t_message;
  
! static t_class *message_class, *mresp_class;
  
  static void message_bang(t_message *x)
! {binbuf_eval(x->m_text.te_binbuf, &x->m_mresp.mr_pd, 0, 0);}
  static void message_float(t_message *x, t_float f) {
      t_atom at;
      SETFLOAT(&at, f);
!     binbuf_eval(x->m_text.te_binbuf, &x->m_mresp.mr_pd, 1, &at);
  }
  static void message_symbol(t_message *x, t_symbol *s) {
      t_atom at;
      SETSYMBOL(&at, s);
!     binbuf_eval(x->m_text.te_binbuf, &x->m_mresp.mr_pd, 1, &at);
  }
  static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_eval(x->m_text.te_binbuf, &x->m_mresp.mr_pd, argc, argv);}
  
  static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
***************
*** 389,428 ****
  }
  
- /*static void message_click(t_message *x, t_floatarg xpos, t_floatarg ypos,
- t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
- {
-     message_float(x, 0);
-     if (!glist_isvisible(x->m_glist))
-     {
-     	t_rtext *y = glist_findrtext(x->m_glist, &x->m_text);
-     	sys_vgui(".x%x.c itemconfigure %sR -width 5\n", 
- 	    glist_getcanvas(x->m_glist), rtext_gettag(y));
-     	clock_delay(x->m_clock, 120);
-     }
- }*/
- 
- static void message_tick(t_message *x)
- {
-     if (glist_isvisible(x->m_glist))
-     {
-     	t_rtext *y = glist_findrtext(x->m_glist, &x->m_text);
-     	sys_vgui(".x%x.c itemconfigure %sR -width 1\n",
- 	    glist_getcanvas(x->m_glist), rtext_gettag(y));
-     }
- }
- 
- static void message_free(t_message *x)
- {clock_free(x->m_clock);}
- 
  void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
  {
      t_message *x = (t_message *)pd_new(message_class);
!     x->m_messresponder.mr_pd = messresponder_class;
!     x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float);
      x->m_text.te_width = 0;	    	    	    	/* don't know it yet. */
      x->m_text.te_type = T_MESSAGE;
      x->m_text.te_binbuf = binbuf_new();
      x->m_glist = gl;
-     x->m_clock = clock_new(x, (t_method)message_tick);
      if (argc > 1)
      {
--- 375,387 ----
  }
  
  void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
  {
      t_message *x = (t_message *)pd_new(message_class);
!     x->m_mresp.mr_pd = mresp_class;
!     x->m_mresp.mr_outlet = outlet_new(&x->m_text, &s_float);
      x->m_text.te_width = 0;	    	    	    	/* don't know it yet. */
      x->m_text.te_type = T_MESSAGE;
      x->m_text.te_binbuf = binbuf_new();
      x->m_glist = gl;
      if (argc > 1)
      {
***************
*** 564,609 ****
  
  static void gatom_float(t_gatom *x, t_float f)
! {
!     t_atom at;
!     SETFLOAT(&at, f);
!     gatom_set(x, 0, 1, &at);
!     gatom_bang(x);
! }
! 
! static void gatom_clipfloat(t_gatom *x, t_float f)
! {
!     if (x->a_draglo != 0 || x->a_draghi != 0)
!     {
! 	if (f < x->a_draglo)
!     	    f = x->a_draglo;
! 	if (f > x->a_draghi)
!     	    f = x->a_draghi;
!     }
!     gatom_float(x, f);
! }
! 
  static void gatom_symbol(t_gatom *x, t_symbol *s)
! {
!     t_atom at;
!     SETSYMBOL(&at, s);
!     gatom_set(x, 0, 1, &at);
!     gatom_bang(x);
! }
  
! static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy)
! {
      t_gatom *x = (t_gatom *)z;
      if (dy == 0) return;
!     if (x->a_atom.a_type == A_FLOAT)
!     {
!     	if (x->a_shift)
!     	{
      	    double nval = x->a_atom.a_w.w_float - 0.01 * dy;
      	    double trunc = 0.01 * (floor(100. * nval + 0.5));
      	    if (trunc < nval + 0.0001 && trunc > nval - 0.0001) nval = trunc;
!     	    gatom_clipfloat(x, nval);
!     	}
!     	else
!     	{
      	    double nval = x->a_atom.a_w.w_float - dy;
      	    double trunc = 0.01 * (floor(100. * nval + 0.5));
--- 523,540 ----
  
  static void gatom_float(t_gatom *x, t_float f)
! {t_atom at; SETFLOAT(&at, f); gatom_set(x, 0, 1, &at); gatom_bang(x);}
  static void gatom_symbol(t_gatom *x, t_symbol *s)
! {t_atom at; SETSYMBOL(&at, s); gatom_set(x, 0, 1, &at); gatom_bang(x);}
  
! /*
! static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy) {
      t_gatom *x = (t_gatom *)z;
      if (dy == 0) return;
!     if (x->a_atom.a_type == A_FLOAT) {
!     	if (x->a_shift) {
      	    double nval = x->a_atom.a_w.w_float - 0.01 * dy;
      	    double trunc = 0.01 * (floor(100. * nval + 0.5));
      	    if (trunc < nval + 0.0001 && trunc > nval - 0.0001) nval = trunc;
!     	} else {
      	    double nval = x->a_atom.a_w.w_float - dy;
      	    double trunc = 0.01 * (floor(100. * nval + 0.5));
***************
*** 611,621 ****
      	    trunc = floor(nval + 0.5);
      	    if (trunc < nval + 0.001 && trunc > nval - 0.001) nval = trunc;
-     	    gatom_clipfloat(x, nval);
      	}
      }
  }
  
! static void gatom_key(void *z, t_floatarg f)
! {
      t_gatom *x = (t_gatom *)z;
      int c = f;
--- 542,553 ----
      	    trunc = floor(nval + 0.5);
      	    if (trunc < nval + 0.001 && trunc > nval - 0.001) nval = trunc;
      	}
+         gatom_clipfloat(x, nval);
      }
  }
+ */
  
! /*
! static void gatom_key(void *z, t_floatarg f) {
      t_gatom *x = (t_gatom *)z;
      int c = f;
***************
*** 623,642 ****
      t_atom at;
      char sbuf[ATOMBUFSIZE + 4];
!     if (c == 0)
!     {
!     	/* we're being notified that no more keys will come for this grab */
  	if (x->a_buf[0])
  	    gatom_retext(x, 1);
  	return;
!     }
!     else if (c == ' ') return;
!     else if (c == '\b')
!     {
      	if (len > 0)
  	x->a_buf[len-1] = 0;
  	goto redraw;
!     }
!     else if (c == '\n')
!     {
  	if (x->a_atom.a_type == A_FLOAT)
      	    x->a_atom.a_w.w_float = atof(x->a_buf);
--- 555,569 ----
      t_atom at;
      char sbuf[ATOMBUFSIZE + 4];
!     if (c == 0) {
!     	// we're being notified that no more keys will come for this grab
  	if (x->a_buf[0])
  	    gatom_retext(x, 1);
  	return;
!     } else if (c == ' ') return;
!     else if (c == '\b') {
      	if (len > 0)
  	x->a_buf[len-1] = 0;
  	goto redraw;
!     } else if (c == '\n') {
  	if (x->a_atom.a_type == A_FLOAT)
      	    x->a_atom.a_w.w_float = atof(x->a_buf);
***************
*** 647,657 ****
  	gatom_retext(x, 1);
      	x->a_buf[0] = 0;
!     }
!     else if (len < (ATOMBUFSIZE-1))
!     {
!     	    /* for numbers, only let reasonable characters through */
      	if ((x->a_atom.a_type == A_SYMBOL) ||
! 	    (c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e' || c == 'E')
! 	{
      	    x->a_buf[len] = c;
      	    x->a_buf[len+1] = 0;
--- 574,580 ----
  	gatom_retext(x, 1);
      	x->a_buf[0] = 0;
!     } else if (len < (ATOMBUFSIZE-1)) {
      	if ((x->a_atom.a_type == A_SYMBOL) ||
! 	    (c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e' || c == 'E') {
      	    x->a_buf[len] = c;
      	    x->a_buf[len+1] = 0;
***************
*** 661,665 ****
      return;
  redraw:
-     	/* LATER figure out how to avoid creating all these symbols! */
      sprintf(sbuf, "%s...", x->a_buf);
      SETSYMBOL(&at, gensym(sbuf));
--- 584,587 ----
***************
*** 667,671 ****
      binbuf_add(x->a_text.te_binbuf, 1, &at);
      glist_retext(x->a_glist, &x->a_text);
! }
  
  /* message back from dialog window */
--- 589,593 ----
      binbuf_add(x->a_text.te_binbuf, 1, &at);
      glist_retext(x->a_glist, &x->a_text);
! }*/
  
  /* message back from dialog window */
***************
*** 1000,1004 ****
      	CLASS_NOINLET | CLASS_PATCHABLE, 0);
  
!     message_class = class_new(gensym("message"), 0, (t_method)message_free,
      	sizeof(t_message), CLASS_PATCHABLE, 0);
      class_addbang(message_class, message_bang);
--- 922,926 ----
      	CLASS_NOINLET | CLASS_PATCHABLE, 0);
  
!     message_class = class_new(gensym("message"), 0,0,
      	sizeof(t_message), CLASS_PATCHABLE, 0);
      class_addbang(message_class, message_bang);
***************
*** 1011,1021 ****
      class_addmethod(message_class, (t_method)message_add2, gensym("add2"), A_GIMME, 0);
  
-     messresponder_class = class_new(gensym("messresponder"), 0, 0, sizeof(t_text), CLASS_PD, 0);
-     class_addbang(messresponder_class, messresponder_bang);
-     class_addfloat(messresponder_class, (t_method) messresponder_float);
-     class_addsymbol(messresponder_class, messresponder_symbol);
-     class_addlist(messresponder_class, messresponder_list);
-     class_addanything(messresponder_class, messresponder_anything);
- 
      gatom_class = class_new(gensym("gatom"), 0, (t_method)gatom_free,
      	sizeof(t_gatom), CLASS_NOINLET | CLASS_PATCHABLE, 0);
--- 933,936 ----
***************
*** 1085,1089 ****
      pd_changed(x);
  }
- 
  static void iemgui_label_pos(t_iemgui *x, t_float ldx, t_float ldy) {
      x->ldx = (int)ldx;
--- 1000,1003 ----
***************
*** 1091,1095 ****
      pd_changed(x);
  }
- 
  static void iemgui_label_font(t_iemgui *x, t_symbol *s, int ac, t_atom *av) {
      x->fontsize = MAX(4,(int)atom_getintarg(1, ac, av));
--- 1005,1008 ----
***************
*** 1097,1101 ****
      pd_changed(x);
  }
! 
  void iemgui_size(t_iemgui *x) {
      if(glist_isvisible(x->glist)) {
--- 1010,1014 ----
      pd_changed(x);
  }
! static
  void iemgui_size(t_iemgui *x) {
      if(glist_isvisible(x->glist)) {
***************
*** 1104,1117 ****
      }
  }
! 
! static void iemgui_delta(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
! {
      x->obj.te_xpix += (int)atom_getintarg(0, ac, av);
      x->obj.te_ypix += (int)atom_getintarg(1, ac, av);
      iemgui_size(x);
  }
! 
! static void iemgui_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
! {
      x->obj.te_xpix = (int)atom_getintarg(0, ac, av);
      x->obj.te_ypix = (int)atom_getintarg(1, ac, av);
--- 1017,1026 ----
      }
  }
! static void iemgui_delta(t_iemgui *x, t_symbol *s, int ac, t_atom *av) {
      x->obj.te_xpix += (int)atom_getintarg(0, ac, av);
      x->obj.te_ypix += (int)atom_getintarg(1, ac, av);
      iemgui_size(x);
  }
! static void iemgui_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av) {
      x->obj.te_xpix = (int)atom_getintarg(0, ac, av);
      x->obj.te_ypix = (int)atom_getintarg(1, ac, av);
***************
*** 1298,1302 ****
      class_setpropertiesfn(c, iemgui_propertiesfn);
  }
! 
  t_iemgui *iemgui_new(t_class *qlass) {
  	t_iemgui *x = (t_iemgui *)pd_new(qlass);
--- 1207,1211 ----
      class_setpropertiesfn(c, iemgui_propertiesfn);
  }
! static
  t_iemgui *iemgui_new(t_class *qlass) {
  	t_iemgui *x = (t_iemgui *)pd_new(qlass);
***************
*** 1316,1320 ****
  	return x;
  }
! 
  void iemgui_propertiesfn(t_gobj *x, t_glist *owner)
  {
--- 1225,1229 ----
  	return x;
  }
! static
  void iemgui_propertiesfn(t_gobj *x, t_glist *owner)
  {
***************
*** 1323,1327 ****
  //    sys_vgui("pdtk_iemgui_dialog %s %x\n", stub->s_name, x);
  }
! 
  void iemgui_constrain(t_iemgui *x) {
      x->fontsize = MAX(x->fontsize,4);
--- 1232,1236 ----
  //    sys_vgui("pdtk_iemgui_dialog %s %x\n", stub->s_name, x);
  }
! static
  void iemgui_constrain(t_iemgui *x) {
      x->fontsize = MAX(x->fontsize,4);
***************
*** 1329,1335 ****
      x->w = iemgui_clip_size(x->w);
  }
! 
  void iemgui_init(t_iemgui *x, t_floatarg f) {x->isa = (x->isa&~1) | !!f;}
! 
  void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
      t_atom foo;
--- 1238,1244 ----
      x->w = iemgui_clip_size(x->w);
  }
! static
  void iemgui_init(t_iemgui *x, t_floatarg f) {x->isa = (x->isa&~1) | !!f;}
! static
  void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
      t_atom foo;
***************
*** 1341,1350 ****
      binbuf_add(buf,argc,argv);
  }
! 
  /*bool*/ int iemgui_loadbang (/*t_iemgui*/ void *x) {
  	t_iemgui *self = (t_iemgui *)x;
  	return !sys_noloadbang && self->isa&1;
  }
! 
  /*bool*/ int iemgui_forward (/*t_iemgui*/ void *x) {
  	t_iemgui *self = (t_iemgui *)x;
--- 1250,1259 ----
      binbuf_add(buf,argc,argv);
  }
! static
  /*bool*/ int iemgui_loadbang (/*t_iemgui*/ void *x) {
  	t_iemgui *self = (t_iemgui *)x;
  	return !sys_noloadbang && self->isa&1;
  }
! static
  /*bool*/ int iemgui_forward (/*t_iemgui*/ void *x) {
  	t_iemgui *self = (t_iemgui *)x;
***************
*** 1643,1648 ****
  }
  
! static void radio_loadbang(t_radio *x)
! {if(iemgui_loadbang(x)) radio_bang(x);}
  
  static void radio_number(t_radio *x, t_floatarg num)
--- 1552,1556 ----
  }
  
! static void radio_loadbang(t_radio *x) {if(iemgui_loadbang(x)) radio_bang(x);}
  
  static void radio_number(t_radio *x, t_floatarg num)
***************
*** 2010,2023 ****
  }
  
- static void nbfree(t_nbx *x)
- {
-     if(x->rcv) pd_unbind((t_pd *)x, x->rcv);
-     gfxstub_deleteforkey(x);
- }
- 
  static void g_numbosetup(void)
  {
      t_class *c = nbclass = class_new(gensym("nbx"), (t_newmethod)nbnew,
! 	(t_method)nbfree, sizeof(t_nbx), 0, A_GIMME, 0);
      class_addcreator((t_newmethod)nbnew, gensym("nbx"), A_GIMME, 0);
      iemgui_subclass(c);
--- 1918,1925 ----
  }
  
  static void g_numbosetup(void)
  {
      t_class *c = nbclass = class_new(gensym("nbx"), (t_newmethod)nbnew,
! 	(t_method)iemgui_free, sizeof(t_nbx), 0, A_GIMME, 0);
      class_addcreator((t_newmethod)nbnew, gensym("nbx"), A_GIMME, 0);
      iemgui_subclass(c);





More information about the Pd-cvs mailing list