[PD-cvs] pd/src g_all_guis.c,1.1.1.4.2.4.2.21,1.1.1.4.2.4.2.22 g_all_guis.h,1.1.1.4.2.2.2.18,1.1.1.4.2.2.2.19 g_array.c,1.1.1.3.2.2.2.5,1.1.1.3.2.2.2.6 g_canvas.h,1.1.1.4.2.4.2.3,1.1.1.4.2.4.2.4 g_editor.c,1.1.1.4.2.3.2.20,1.1.1.4.2.3.2.21 g_numbox.c,1.1.1.4.2.2.2.12,1.1.1.4.2.2.2.13 g_rtext.c,1.1.1.2.2.6.2.9,1.1.1.2.2.6.2.10 g_text.c,1.1.1.4.2.2.2.14,1.1.1.4.2.2.2.15 g_vumeter.c,1.1.1.3.2.2.2.11,1.1.1.3.2.2.2.12

Mathieu Bouchard matju at users.sourceforge.net
Mon May 3 04:57:29 CEST 2004


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

Modified Files:
      Tag: impd_0_37
	g_all_guis.c g_all_guis.h g_array.c g_canvas.h g_editor.c 
	g_numbox.c g_rtext.c g_text.c g_vumeter.c 
Log Message:
...


Index: g_array.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_array.c,v
retrieving revision 1.1.1.3.2.2.2.5
retrieving revision 1.1.1.3.2.2.2.6
diff -C2 -d -r1.1.1.3.2.2.2.5 -r1.1.1.3.2.2.2.6
*** g_array.c	1 May 2004 01:46:18 -0000	1.1.1.3.2.2.2.5
--- g_array.c	3 May 2004 02:57:27 -0000	1.1.1.3.2.2.2.6
***************
*** 566,577 ****
  }
  
! static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy)
! {/* refuse */}
! static void garray_select(t_gobj *z, t_glist *glist, int state)
! {}
! static void garray_activate(t_gobj *z, t_glist *glist, int state)
! {}
! static void garray_delete(t_gobj *z, t_glist *glist)
! {/* nothing to do */}
  
  static void garray_vis(t_gobj *z, t_glist *glist, int vis)
--- 566,573 ----
  }
  
! static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy) {/*refuse*/}
! static void garray_select  (t_gobj *z, t_glist *glist, int state) {}
! static void garray_activate(t_gobj *z, t_glist *glist, int state) {}
! static void garray_delete  (t_gobj *z, t_glist *glist) {/* nothing to do */}
  
  static void garray_vis(t_gobj *z, t_glist *glist, int vis)
***************
*** 905,909 ****
  {
      t_template *template = garray_template(x);
!     int yonset, type, i;
      t_symbol *arraytype;
      if (!template_find_field(template, gensym("y"), &yonset,
--- 901,905 ----
  {
      t_template *template = garray_template(x);
!     int yonset, type;
      t_symbol *arraytype;
      if (!template_find_field(template, gensym("y"), &yonset,
***************
*** 914,917 ****
--- 910,914 ----
      else
      {
+ 	int i;
      	int firstindex = atom_getfloat(argv);
      	argc--;
***************
*** 1001,1005 ****
  }
  
!     /* this should be renamed and moved... */
  int garray_ambigendian(void)
  {
--- 998,1002 ----
  }
  
! /* this should be renamed and moved... */
  int garray_ambigendian(void)
  {
***************
*** 1009,1015 ****
  }
  
- #define BINREADMODE "rb"
- #define BINWRITEMODE "wb"
- 
  static void garray_read16(t_garray *x, t_symbol *filename,
      t_symbol *endian, t_floatarg fskip)
--- 1006,1009 ----
***************
*** 1038,1042 ****
      	canvas_getdir(glist_getcanvas(x->x_glist))->s_name,
      	    filename->s_name, "", buf, &bufptr, MAXPDSTRING, 1)) < 0 
! 	    	|| !(fd = fdopen(filedesc, BINREADMODE)))
      {
      	error("%s: can't open", filename->s_name);
--- 1032,1036 ----
      	canvas_getdir(glist_getcanvas(x->x_glist))->s_name,
      	    filename->s_name, "", buf, &bufptr, MAXPDSTRING, 1)) < 0 
! 	    	|| !(fd = fdopen(filedesc, "rb")))
      {
      	error("%s: can't open", filename->s_name);
***************
*** 1117,1120 ****
--- 1111,1122 ----
  #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
  
+ /*
+ static unsigned swap32 (unsigned x) {
+ 	x = (x<<16) | (x>>16);
+ 	x = ((x&0xff00ff)<<8) | ((x>>8)&0xff00ff);
+ 	return x;
+ }
+ */
+ 
  /* wave format only so far */
  static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
***************
*** 1150,1154 ****
      	buf2, MAXPDSTRING);
      sys_bashfilename(buf2, buf2);
!     if (!(fd = fopen(buf2, BINWRITEMODE)))
      {
      	error("%s: can't create", buf2);
--- 1152,1156 ----
      	buf2, MAXPDSTRING);
      sys_bashfilename(buf2, buf2);
!     if (!(fd = fopen(buf2, "wb")))
      {
      	error("%s: can't create", buf2);

Index: g_text.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_text.c,v
retrieving revision 1.1.1.4.2.2.2.14
retrieving revision 1.1.1.4.2.2.2.15
diff -C2 -d -r1.1.1.4.2.2.2.14 -r1.1.1.4.2.2.2.15
*** g_text.c	26 Apr 2004 11:37:43 -0000	1.1.1.4.2.2.2.14
--- g_text.c	3 May 2004 02:57:27 -0000	1.1.1.4.2.2.2.15
***************
*** 662,669 ****
  
  static void gatom_displace(t_gobj *z, t_glist *glist, int dx, int dy)
! {
!     t_gatom *x = (t_gatom*)z;
!     text_displace(z, glist, dx, dy);
! }
  
  static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
--- 662,666 ----
  
  static void gatom_displace(t_gobj *z, t_glist *glist, int dx, int dy)
! {text_displace(z, glist, dx, dy);}
  
  static void gatom_vis(t_gobj *z, t_glist *glist, int vis)

Index: g_vumeter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_vumeter.c,v
retrieving revision 1.1.1.3.2.2.2.11
retrieving revision 1.1.1.3.2.2.2.12
diff -C2 -d -r1.1.1.3.2.2.2.11 -r1.1.1.3.2.2.2.12
*** g_vumeter.c	1 May 2004 15:38:35 -0000	1.1.1.3.2.2.2.11
--- g_vumeter.c	3 May 2004 02:57:27 -0000	1.1.1.3.2.2.2.12
***************
*** 6,10 ****
  /* Copyright 2004 by Mathieu Bouchard */
  
- 
  #include <stdlib.h>
  #include <string.h>
--- 6,9 ----
***************
*** 55,69 ****
  
  static void vu_update_rms(t_vu *x, t_glist *glist)
! {
!     if(glist_isvisible(glist))
! 	sys_mgui((t_iemgui *)x,"vu","set","i",x->x_rms);
! }
! 
  static void vu_update_peak(t_vu *x, t_glist *glist)
! {
!     if(glist_isvisible(glist))
! 	/*if(x->x_peak)*/
! 	    sys_mgui((t_iemgui *)x,"vu","peak","i",x->x_peak);
! }
  
  void vu_draw(t_vu *x, t_glist *glist, int mode)
--- 54,60 ----
  
  static void vu_update_rms(t_vu *x, t_glist *glist)
! {if(glist_isvisible(glist)) sys_mgui((t_iemgui *)x,"vu","set","i",x->x_rms);}
  static void vu_update_peak(t_vu *x, t_glist *glist)
! {if(glist_isvisible(glist)) sys_mgui((t_iemgui *)x,"vu","peak","i",x->x_peak);}
  
  void vu_draw(t_vu *x, t_glist *glist, int mode)
***************
*** 83,93 ****
  /* ------------------------ vu widgetbehaviour----------------------------- */
  
- 
  static void vu_getrect(t_gobj *z, t_glist *glist,
! 		       int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_vu* x = (t_vu*)z;
!     *xp1 = text_xpix(&x->x_gui.x_obj, glist) - 1;
!     *yp1 = text_ypix(&x->x_gui.x_obj, glist) - 2;
      *xp2 = *xp1 + x->x_gui.x_w + 2;
      *yp2 = *yp1 + x->x_gui.x_h + 4;
--- 74,83 ----
  /* ------------------------ vu widgetbehaviour----------------------------- */
  
  static void vu_getrect(t_gobj *z, t_glist *glist,
! int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_vu* x = (t_vu*)z;
!     *xp1 = text_xpix((t_pd *)x, glist) - 1;
!     *yp1 = text_ypix((t_pd *)x, glist) - 2;
      *xp2 = *xp1 + x->x_gui.x_w + 2;
      *yp2 = *yp1 + x->x_gui.x_h + 4;
***************
*** 121,126 ****
  
  static void vu_scale(t_vu *x, t_floatarg fscale)
! {x->x_scale = !! (int)fscale;
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist,0);}
  
  static void vu_properties(t_gobj *z, t_glist *owner)
--- 111,115 ----
  
  static void vu_scale(t_vu *x, t_floatarg fscale)
! {x->x_scale = !!fscale; x->x_gui.x_draw(x, x->x_gui.x_glist,0);}
  
  static void vu_properties(t_gobj *z, t_glist *owner)
***************
*** 137,143 ****
  	    %s %s %s %d %d %d %d %d %d %d\n",
  	    x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_VU_STEPS*IEM_VU_MINSIZE,
! 	    0,/*no_schedule*/
! 	    x->x_scale, -1, -1, -1,/*no linlog, no init, no multi*/
! 	    "nosndno", srl[1]->s_name,/*no send*/
  	    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,
--- 126,130 ----
  	    %s %s %s %d %d %d %d %d %d %d\n",
  	    x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_VU_STEPS*IEM_VU_MINSIZE,
! 	    0, x->x_scale, -1, -1, -1, "nosndno", 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,
***************
*** 166,171 ****
  {
      x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
!     if(ac > 1)
!         vu_check_height(x, (int)atom_getintarg(1, ac, av));
      if(glist_isvisible(x->x_gui.x_glist))
      {
--- 153,157 ----
  {
      x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
!     if(ac > 1) vu_check_height(x, (int)atom_getintarg(1, ac, av));
      if(glist_isvisible(x->x_gui.x_glist))
      {
***************
*** 211,215 ****
  static void *vu_new(t_symbol *s, int argc, t_atom *argv)
  {
!     t_vu *x = (t_vu *)pd_new(vu_class);
      int bflcol[]={-66577, -1, -1};
      int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
--- 197,201 ----
  static void *vu_new(t_symbol *s, int argc, t_atom *argv)
  {
!     t_vu *x = (t_vu *)iemgui_new(vu_class);
      int bflcol[]={-66577, -1, -1};
      int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
***************
*** 227,240 ****
  	iem_inttosymargs(&x->x_gui, atom_getintarg(11, argc, argv));
      x->x_gui.x_draw = (t_iemfunptr)vu_draw;
- 
      x->x_gui.x_snd_able = 0;
      x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
-     x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
      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;
- 
      x->x_gui.x_fontsize = MAX(fs,4);
      x->x_gui.x_w = iemgui_clip_size(w);
--- 213,222 ----
  	iem_inttosymargs(&x->x_gui, atom_getintarg(11, argc, argv));
      x->x_gui.x_draw = (t_iemfunptr)vu_draw;
      x->x_gui.x_snd_able = 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_ldx = ldx;
      x->x_gui.x_ldy = ldy;
      x->x_gui.x_fontsize = MAX(fs,4);
      x->x_gui.x_w = iemgui_clip_size(w);
***************
*** 255,260 ****
  static void vu_free(t_vu *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);
  }
--- 237,241 ----
  static void vu_free(t_vu *x)
  {
!     if(x->x_gui.x_rcv_able) pd_unbind((t_pd *)x, x->x_gui.x_rcv);
      gfxstub_deleteforkey(x);
  }

Index: g_canvas.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.h,v
retrieving revision 1.1.1.4.2.4.2.3
retrieving revision 1.1.1.4.2.4.2.4
diff -C2 -d -r1.1.1.4.2.4.2.3 -r1.1.1.4.2.4.2.4
*** g_canvas.h	1 May 2004 01:46:18 -0000	1.1.1.4.2.4.2.3
--- g_canvas.h	3 May 2004 02:57:27 -0000	1.1.1.4.2.4.2.4
***************
*** 495,500 ****
  EXTERN int canvas_isconnected (t_canvas *x,
      t_text *ob1, int n1, t_text *ob2, int n2);
! EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy);
! 
  
  /* ---- functions on canvasses as objects  --------------------- */
--- 495,500 ----
  EXTERN int canvas_isconnected (t_canvas *x,
      t_text *ob1, int n1, t_text *ob2, int n2);
! /*send a pd message instead of this: */
! /*EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy);*/
  
  /* ---- functions on canvasses as objects  --------------------- */

Index: g_all_guis.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.c,v
retrieving revision 1.1.1.4.2.4.2.21
retrieving revision 1.1.1.4.2.4.2.22
diff -C2 -d -r1.1.1.4.2.4.2.21 -r1.1.1.4.2.4.2.22
*** g_all_guis.c	1 May 2004 15:38:35 -0000	1.1.1.4.2.4.2.21
--- g_all_guis.c	3 May 2004 02:57:27 -0000	1.1.1.4.2.4.2.22
***************
*** 218,227 ****
  void iemgui_send(t_iemgui *iemgui, t_symbol *s)
  {
!     t_symbol *snd;
!     snd = iemgui_raute2dollar(s);
      iemgui->x_snd_unexpanded = snd;
!     iemgui->x_snd = snd = canvas_realizedollar(iemgui->x_glist, snd);
!         post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name,
!     	    iemgui->x_snd->s_name);
      iemgui->x_snd_able = strcmp(s->s_name, "empty");
      iemgui_verify_snd_ne_rcv(iemgui);
--- 218,225 ----
  void iemgui_send(t_iemgui *iemgui, t_symbol *s)
  {
!     t_symbol *snd = iemgui_raute2dollar(s);
      iemgui->x_snd_unexpanded = snd;
!     iemgui->x_snd = canvas_realizedollar(iemgui->x_glist, snd);
!     post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name, iemgui->x_snd->s_name);
      iemgui->x_snd_able = strcmp(s->s_name, "empty");
      iemgui_verify_snd_ne_rcv(iemgui);
***************
*** 231,238 ****
  void iemgui_receive(t_iemgui *iemgui, t_symbol *s)
  {
!     t_symbol *rcv;
!     int rcvable=1;
!     if(!strcmp(s->s_name, "empty")) rcvable = 0;
!     rcv = iemgui_raute2dollar(s);
      iemgui->x_rcv_unexpanded = rcv;
      iemgui->x_rcv = rcv = canvas_realizedollar(iemgui->x_glist, rcv);
--- 229,234 ----
  void iemgui_receive(t_iemgui *iemgui, t_symbol *s)
  {
!     t_symbol *rcv = iemgui_raute2dollar(s);
!     int rcvable = !!strcmp(s->s_name, "empty");
      iemgui->x_rcv_unexpanded = rcv;
      iemgui->x_rcv = rcv = canvas_realizedollar(iemgui->x_glist, rcv);
***************
*** 322,333 ****
  void iemgui_color(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
  {
!     iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av));
!     if(ac > 2)
!     {
! 	iemgui->x_fcol = iemgui_compatible_col(atom_getintarg(1, ac, av));
! 	iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(2, ac, av));
!     }
!     else
! 	iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(1, ac, av));
      if(glist_isvisible(iemgui->x_glist))
  	iemgui->x_draw(iemgui, iemgui->x_glist, 0);
--- 318,325 ----
  void iemgui_color(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
  {
!     int i=0;
!     iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(i++, ac, av));
!     if(ac > 2) iemgui->x_fcol = iemgui_compatible_col(atom_getintarg(i++, ac, av));
!     iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(i++, ac, av));
      if(glist_isvisible(iemgui->x_glist))
  	iemgui->x_draw(iemgui, iemgui->x_glist, 0);
***************
*** 352,356 ****
  void iemgui_delete(t_gobj *z, t_glist *glist)
  {
!     canvas_deletelinesfor(glist, (t_text *)z);
  }
  
--- 344,348 ----
  void iemgui_delete(t_gobj *z, t_glist *glist)
  {
!     canvas_deletelinesfor(glist, (t_text *)z); /*why?*/
  }
  
***************
*** 386,391 ****
      init = !!init;
      iemgui->x_loadinit = init;
!     sndable = strcmp(srl[0]->s_name, "empty");
!     rcvable = strcmp(srl[1]->s_name, "empty");
      iemgui_all_raute2dollar(srl);
      iemgui_all_dollararg2sym(iemgui, srl);
--- 378,383 ----
      init = !!init;
      iemgui->x_loadinit = init;
!     sndable = !!strcmp(srl[0]->s_name, "empty");
!     rcvable = !!strcmp(srl[1]->s_name, "empty");
      iemgui_all_raute2dollar(srl);
      iemgui_all_dollararg2sym(iemgui, srl);
***************
*** 579,582 ****
--- 571,575 ----
  EXTERN t_iemgui *iemgui_new(t_class *qlass) {
  	t_iemgui *self = (t_iemgui *)pd_new(qlass);
+ 	self->x_glist = (t_glist *)canvas_getcurrent();
  	self->x_ldx=0;
  	self->x_ldy=-6;
***************
*** 603,604 ****
--- 596,605 ----
  }
  
+ /*
+ EXTERN t_symbol *iemgui_gensym(void *x) {
+ 	char buf[42];
+ 	sprintf(buf,"x%x",(int)x);
+ 	fprintf(stderr,"gensym: %s\n",buf);
+ 	return gensym(x);
+ }
+ */

Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.1.1.4.2.3.2.20
retrieving revision 1.1.1.4.2.3.2.21
diff -C2 -d -r1.1.1.4.2.3.2.20 -r1.1.1.4.2.3.2.21
*** g_editor.c	1 May 2004 18:19:03 -0000	1.1.1.4.2.3.2.20
--- g_editor.c	3 May 2004 02:57:27 -0000	1.1.1.4.2.3.2.21
***************
*** 1099,1103 ****
  {
      t_editor *e = x->gl_editor;
!     fprintf(stderr,"MOUSEUP!\n");
      if (!e) {bug("editor"); return;}
  #ifdef SIMULATERIGHTCLICK
--- 1099,1103 ----
  {
      t_editor *e = x->gl_editor;
!     //fprintf(stderr,"MOUSEUP!\n");
      if (!e) {bug("editor"); return;}
  #ifdef SIMULATERIGHTCLICK
***************
*** 1110,1114 ****
      	/* after motion, if there's only one item selected, activate it */
      	if (e->e_selection && !e->e_selection->sel_next) {
! 		fprintf(stderr,"ACTIVATE!\n");
      	    	gobj_activate(e->e_selection->sel_what, x, 1);
  	}
--- 1110,1114 ----
      	/* after motion, if there's only one item selected, activate it */
      	if (e->e_selection && !e->e_selection->sel_next) {
! 		//fprintf(stderr,"ACTIVATE!\n");
      	    	gobj_activate(e->e_selection->sel_what, x, 1);
  	}

Index: g_all_guis.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.h,v
retrieving revision 1.1.1.4.2.2.2.18
retrieving revision 1.1.1.4.2.2.2.19
diff -C2 -d -r1.1.1.4.2.2.2.18 -r1.1.1.4.2.2.2.19
*** g_all_guis.h	1 May 2004 15:38:35 -0000	1.1.1.4.2.2.2.18
--- g_all_guis.h	3 May 2004 02:57:27 -0000	1.1.1.4.2.2.2.19
***************
*** 37,44 ****
      char x_font[16];
      /* formerly x_isa: */
!     unsigned int x_loadinit:1;
!     unsigned int x_scale:1;
!     unsigned int x_flashed:1;
!     unsigned int x_locked:1;
      /* formerly x_fsf: */
      unsigned int x_rcv_able:1, x_snd_able:1, x_selected:1, x_finemoved:1,
--- 37,41 ----
      char x_font[16];
      /* formerly x_isa: */
!     unsigned int x_loadinit:1, x_scale:1, x_flashed:1, x_locked:1;
      /* formerly x_fsf: */
      unsigned int x_rcv_able:1, x_snd_able:1, x_selected:1, x_finemoved:1,
***************
*** 77,81 ****
  } t_hslider;
  
! typedef struct _hdial
  {
      t_iemgui x_gui;
--- 74,78 ----
  } t_hslider;
  
! typedef struct _radio
  {
      t_iemgui x_gui;
***************
*** 85,89 ****
      int      x_number;
      t_atom   x_at[2];
! } t_hradio;
  
  typedef struct _toggle
--- 82,87 ----
      int      x_number;
      t_atom   x_at[2];
!     t_symbol *x_flavor;
! } t_hradio, t_radio;
  
  typedef struct _toggle
***************
*** 137,143 ****
  } t_my_numbox;
  
! extern int sys_noloadbang;
! extern int iemgui_color_hex[];
! 
  EXTERN int iemgui_clip_size(int size);
  EXTERN int iemgui_clip_font(int size);
--- 135,139 ----
  } t_my_numbox;
  
! EXTERN int sys_noloadbang;
  EXTERN int iemgui_clip_size(int size);
  EXTERN int iemgui_clip_font(int size);
***************
*** 185,186 ****
--- 181,183 ----
  EXTERN t_iemgui *iemgui_new(t_class *qlass);
  EXTERN void iemgui_draw(t_iemgui *x, t_glist *glist, int mode, const char *s);
+ /*EXTERN t_symbol *iemgui_gensym(void *x);*/

Index: g_rtext.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_rtext.c,v
retrieving revision 1.1.1.2.2.6.2.9
retrieving revision 1.1.1.2.2.6.2.10
diff -C2 -d -r1.1.1.2.2.6.2.9 -r1.1.1.2.2.6.2.10
*** g_rtext.c	19 Apr 2004 17:28:39 -0000	1.1.1.2.2.6.2.9
--- g_rtext.c	3 May 2004 02:57:27 -0000	1.1.1.2.2.6.2.10
***************
*** 57,79 ****
  }
  
- static t_rtext *rtext_entered;
- 
  void rtext_free(t_rtext *x)
  {
!     if (x->x_glist->gl_editor->e_textedfor == x)
!     	x->x_glist->gl_editor->e_textedfor = 0;
!     if (x->x_glist->gl_editor->e_rtext == x)
!     	x->x_glist->gl_editor->e_rtext = x->x_next;
      else
      {
      	t_rtext *e2;
!     	for (e2 = x->x_glist->gl_editor->e_rtext; e2; e2 = e2->x_next)
!     	    if (e2->x_next == x)
!     	{
!     	    e2->x_next = x->x_next;
!     	    break;
!     	}
      }
-     if (rtext_entered == x) rtext_entered = 0;
      freebytes(x->x_buf, x->x_bufsize);
      freebytes(x, sizeof *x);
--- 57,71 ----
  }
  
  void rtext_free(t_rtext *x)
  {
!     t_editor *e = x->x_glist->gl_editor;
!     if (e->e_textedfor == x) e->e_textedfor = 0;
!     if (e->e_rtext == x) e->e_rtext = x->x_next;
      else
      {
      	t_rtext *e2;
!     	for (e2 = e->e_rtext; e2; e2 = e2->x_next)
!     	    if (e2->x_next == x) {e2->x_next = x->x_next; break;}
      }
      freebytes(x->x_buf, x->x_bufsize);
      freebytes(x, sizeof *x);
***************
*** 82,86 ****
  char *rtext_gettag(t_rtext *x)
  {
!     return (x->x_tag);
  }
  
--- 74,78 ----
  char *rtext_gettag(t_rtext *x)
  {
!     return x->x_tag;
  }
  
***************
*** 91,97 ****
  }
  
- 
  /* LATER deal with tcl-significant characters */
- 
  static int firstone(char *s, int c, int n)
  {
--- 83,87 ----
***************
*** 133,138 ****
  extern int sys_oldtclversion;	    	
  
! static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
!     int *indexp)
  {
      float dispx, dispy;
--- 123,127 ----
  extern int sys_oldtclversion;	    	
  
! static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, int *indexp)
  {
      float dispx, dispy;
***************
*** 157,176 ****
      	    {
      		foundit = lastone(bp, ' ', maxindex);
!     		if (foundit < 0)
!     		{
!     	    	    foundit = maxindex;
!     	    	    eatchar = 0;
!     		}
!    	    }
!    	    else
!    	    {
!    	    	foundit = inchars;
!    	    	eatchar = 0;
     	    }
     	}
  	if (nlines == findy)
  	{
! 	    int actualx = (findx < 0 ? 0 :
! 	    	(findx > foundit ? foundit : findx));
  	    *indexp = (bp - x->x_buf) + actualx;
  	    reportedindex = 1;
--- 146,156 ----
      	    {
      		foundit = lastone(bp, ' ', maxindex);
!     		if (foundit < 0) {foundit = maxindex; eatchar = 0;}
     	    }
+    	    else {foundit=inchars; eatchar=0;}
     	}
  	if (nlines == findy)
  	{
! 	    int actualx = (findx < 0 ? 0 : (findx > foundit ? foundit : findx));
  	    *indexp = (bp - x->x_buf) + actualx;
  	    reportedindex = 1;
***************
*** 193,201 ****
      if (!widthspec)
      {
!     	while (ncolumns < 3)
!     	{
!     	    tempbuf[outchars++] = ' ';
!     	    ncolumns++;
!     	}
      }
      else ncolumns = widthspec;
--- 173,177 ----
      if (!widthspec)
      {
!     	while (ncolumns < 3) {tempbuf[outchars++]=' '; ncolumns++;}
      }
      else ncolumns = widthspec;
***************
*** 203,207 ****
      pixhigh = nlines * fontheight + (TMARGIN + BMARGIN);
      if (action == SEND_FIRST) {
- /*	post("rtext_senditup pdtk_text_new: %.*s",outchars,tempbuf);*/
      	sys_vgui("global look; pdtk_text_new .x%x.c %s %f %f {%.*s} %d %s\n",
  	    canvas, x->x_tag,
--- 179,182 ----
***************
*** 213,236 ****
      else if (action == SEND_UPDATE)
      {
! /*	post("rtext_senditup pdtk_text_set: %.*s",outchars,tempbuf);*/
!     	sys_vgui("pdtk_text_set .x%x.c %s {%.*s}\n",
!     	    canvas, x->x_tag, outchars, tempbuf);
      	if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight) 
! 	    text_drawborder(x->x_text, x->x_glist, x->x_tag,
! 	    	pixwide, pixhigh, 0);
!     	if (x->x_active)
! 	{
!     	    if (x->x_selend > x->x_selstart)
! 	    {
      		sys_vgui(".x%x.c select from %s %d\n", canvas, x->x_tag, x->x_selstart);
!     		sys_vgui(".x%x.c select to %s %d\n", canvas, 
!     	    	    x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1));
  	    	sys_vgui(".x%x.c focus \"\"\n", canvas);	
!     	    }
! 	    else
! 	    {
      		sys_vgui(".x%x.c select clear\n", canvas);
! 	    	sys_vgui(".x%x.c icursor %s %d\n", canvas, x->x_tag,
! 		    x->x_selstart);
  	    	sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag);	
  	    }
--- 188,202 ----
      else if (action == SEND_UPDATE)
      {
!     	sys_vgui("pdtk_text_set .x%x.c %s {%.*s}\n", canvas, x->x_tag, outchars, tempbuf);
      	if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight) 
! 	    text_drawborder(x->x_text,x->x_glist,x->x_tag,pixwide,pixhigh,0);
!     	if (x->x_active) {
!     	    if (x->x_selend>x->x_selstart) {
      		sys_vgui(".x%x.c select from %s %d\n", canvas, x->x_tag, x->x_selstart);
!     		sys_vgui(".x%x.c select to %s %d\n", canvas, x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1));
  	    	sys_vgui(".x%x.c focus \"\"\n", canvas);	
!     	    } else {
      		sys_vgui(".x%x.c select clear\n", canvas);
! 	    	sys_vgui(".x%x.c icursor %s %d\n", canvas, x->x_tag, x->x_selstart);
  	    	sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag);	
  	    }
***************
*** 264,278 ****
  		*s1, *s2;
  	    for (decimal = x->x_buf; decimal < ebuf; decimal++)
! 	    	if (*decimal == '.')
! 		    break;
! 	    if (decimal >= ebuf)
! 	    	goto giveup;
  	    for (nextchar = decimal + 1; nextchar < ebuf; nextchar++)
  	    	if (*nextchar < '0' || *nextchar > '9')
  		    break;
! 	    if (nextchar - decimal - 1 < wantreduce)
! 	    	goto giveup;
! 	    for (s1 = nextchar - wantreduce, s2 = s1 + wantreduce;
! 	    	s2 < ebuf; s1++, s2++)
  		    *s1 = *s2;
  	    t_resizebytes(x->x_buf, bufsize, text->te_width);
--- 230,240 ----
  		*s1, *s2;
  	    for (decimal = x->x_buf; decimal < ebuf; decimal++)
! 		if (*decimal == '.') break;
! 	    if (decimal >= ebuf) goto giveup;
  	    for (nextchar = decimal + 1; nextchar < ebuf; nextchar++)
  	    	if (*nextchar < '0' || *nextchar > '9')
  		    break;
! 	    if (nextchar - decimal - 1 < wantreduce) goto giveup;
! 	    for (s1=nextchar-wantreduce, s2=s1+wantreduce; s2<ebuf; s1++, s2++)
  		    *s1 = *s2;
  	    t_resizebytes(x->x_buf, bufsize, text->te_width);
***************
*** 306,331 ****
  }
  
! int rtext_width(t_rtext *x)
! {int w=0, h=0, i; rtext_senditup(x, SEND_CHECK, &w, &h, &i); return w;}
! int rtext_height(t_rtext *x)
! {int w=0, h=0, i; rtext_senditup(x, SEND_CHECK, &w, &h, &i); return h;}
! void rtext_draw(t_rtext *x)
! {int w=0, h=0, i; rtext_senditup(x, SEND_FIRST, &w, &h, &i);}
  
  void rtext_erase(t_rtext *x)
! {
!     sys_vgui("pdtk_text_delete .x%x.c %s\n", glist_getcanvas(x->x_glist), x->x_tag);
! }
  
  void rtext_displace(t_rtext *x, int dx, int dy)
! {
!     sys_vgui(".x%x.c move %s %d %d\n", glist_getcanvas(x->x_glist), 
!     	x->x_tag, dx, dy);
! }
  
  void rtext_select(t_rtext *x, int state)
! {
!     t_glist *glist = x->x_glist;
!     t_canvas *canvas = glist_getcanvas(glist);
      sys_vgui(".x%x.c itemconfigure %s -fill %s\n", canvas, 
      	x->x_tag, (state? "blue" : "black"));
--- 268,283 ----
  }
  
! int rtext_width(t_rtext *x)  {int w=0, h=0, i; rtext_senditup(x, SEND_CHECK, &w, &h, &i); return w;}
! int rtext_height(t_rtext *x) {int w=0, h=0, i; rtext_senditup(x, SEND_CHECK, &w, &h, &i); return h;}
! void rtext_draw(t_rtext *x)  {int w=0, h=0, i; rtext_senditup(x, SEND_FIRST, &w, &h, &i);}
  
  void rtext_erase(t_rtext *x)
! {sys_vgui("pdtk_text_delete .x%x.c %s\n", glist_getcanvas(x->x_glist), x->x_tag);}
  
  void rtext_displace(t_rtext *x, int dx, int dy)
! {sys_vgui(".x%x.c move %s %d %d\n", glist_getcanvas(x->x_glist), x->x_tag, dx, dy);}
  
  void rtext_select(t_rtext *x, int state)
! {t_canvas *canvas = glist_getcanvas(x->x_glist);
      sys_vgui(".x%x.c itemconfigure %s -fill %s\n", canvas, 
      	x->x_tag, (state? "blue" : "black"));
***************
*** 338,349 ****
      t_glist *glist = x->x_glist;
      t_canvas *canvas = glist_getcanvas(glist);
      if (state)
      {
  	sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag);
!     	glist->gl_editor->e_textedfor = x;
!     	glist->gl_editor->e_textdirty = 0;
  	x->x_dragfrom = x->x_selstart = 0;
  	x->x_selend = x->x_bufsize;
- 	x->x_active = 1;
      }
      else
--- 290,301 ----
      t_glist *glist = x->x_glist;
      t_canvas *canvas = glist_getcanvas(glist);
+     t_editor *e = glist->gl_editor;
      if (state)
      {
  	sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag);
!     	e->e_textedfor = x;
!     	e->e_textdirty = 0;
  	x->x_dragfrom = x->x_selstart = 0;
  	x->x_selend = x->x_bufsize;
      }
      else
***************
*** 351,359 ****
      	sys_vgui("selection clear .x%x.c\n", canvas);
  	sys_vgui(".x%x.c focus \"\"\n", canvas);
!     	if (glist->gl_editor->e_textedfor == x)
!     	    glist->gl_editor->e_textedfor = 0;
! 	x->x_active = 0;
      }
!     rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);
  }
  
--- 303,310 ----
      	sys_vgui("selection clear .x%x.c\n", canvas);
  	sys_vgui(".x%x.c focus \"\"\n", canvas);
!     	if (e->e_textedfor == x) e->e_textedfor = 0;
      }
!      x->x_active = !!state;
!      rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);
  }
  
***************
*** 457,469 ****
      else if (flag == RTEXT_SHIFT)
      {
!     	if (indx * 2 > x->x_selstart + x->x_selend)
! 	    x->x_dragfrom = x->x_selstart, x->x_selend = indx;
!     	else
! 	    x->x_dragfrom = x->x_selend, x->x_selstart = indx;
      }
      else if (flag == RTEXT_DRAG)
      {
!     	x->x_selstart = (x->x_dragfrom < indx ? x->x_dragfrom : indx);
!     	x->x_selend = (x->x_dragfrom > indx ? x->x_dragfrom : indx);
      }
      rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);
--- 408,421 ----
      else if (flag == RTEXT_SHIFT)
      {
!     	if (indx * 2 > x->x_selstart + x->x_selend) {
! 		x->x_dragfrom = x->x_selstart;    x->x_selend = indx;
! 	} else {
! 		x->x_dragfrom = x->x_selend;    x->x_selstart = indx;
! 	}
      }
      else if (flag == RTEXT_DRAG)
      {
!     	x->x_selstart = x->x_dragfrom<indx ? x->x_dragfrom : indx;
!     	x->x_selend   = x->x_dragfrom>indx ? x->x_dragfrom : indx;
      }
      rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);

Index: g_numbox.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_numbox.c,v
retrieving revision 1.1.1.4.2.2.2.12
retrieving revision 1.1.1.4.2.2.2.13
diff -C2 -d -r1.1.1.4.2.2.2.12 -r1.1.1.4.2.2.2.13
*** g_numbox.c	1 May 2004 15:38:35 -0000	1.1.1.4.2.2.2.12
--- g_numbox.c	3 May 2004 02:57:27 -0000	1.1.1.4.2.2.2.13
***************
*** 128,138 ****
  /* ------------------------ nbx widgetbehaviour----------------------------- */
  
- 
  static void my_numbox_getrect(t_gobj *z, t_glist *glist,
! 			      int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_my_numbox* x = (t_my_numbox*)z;
!     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
!     *yp1 = text_ypix(&x->x_gui.x_obj, glist);
      *xp2 = *xp1 + x->x_numwidth;
      *yp2 = *yp1 + x->x_gui.x_h;
--- 128,137 ----
  /* ------------------------ nbx widgetbehaviour----------------------------- */
  
  static void my_numbox_getrect(t_gobj *z, t_glist *glist,
! int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_my_numbox* x = (t_my_numbox*)z;
!     *xp1 = text_xpix((t_text *)x, glist);
!     *yp1 = text_ypix((t_text *)x, glist);
      *xp2 = *xp1 + x->x_numwidth;
      *yp2 = *yp1 + x->x_gui.x_h;
***************
*** 159,164 ****
  		(float)x->x_min, (float)x->x_max,
  		x->x_lin0_log1, iem_symargstoint(&x->x_gui),
! 		srl[0], srl[1], srl[2],
! 		x->x_gui.x_ldx, x->x_gui.x_ldy,
  		x->x_gui.x_font_style, x->x_gui.x_fontsize,
  		bflcol[0], bflcol[1], bflcol[2],
--- 158,162 ----
  		(float)x->x_min, (float)x->x_max,
  		x->x_lin0_log1, iem_symargstoint(&x->x_gui),
! 		srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
  		x->x_gui.x_font_style, x->x_gui.x_fontsize,
  		bflcol[0], bflcol[1], bflcol[2],
***************
*** 170,176 ****
  {
      int ret=0;
! 
!     if(x->x_lin0_log1)
!     {
  	if(min==0.0 && max==0.0) max = 1.0;
  	if(max > 0.0) {
--- 168,172 ----
  {
      int ret=0;
!     if(x->x_lin0_log1) {
  	if(min==0.0 && max==0.0) max = 1.0;
  	if(max > 0.0) {
***************
*** 248,252 ****
      my_numbox_check_minmax(x, min, max);
      x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
!     canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
  }
  
--- 244,248 ----
      my_numbox_check_minmax(x, min, max);
      x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
!     canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text *)x);
  }
  
***************
*** 341,359 ****
      x->x_lin0_log1 = 1;
      if(my_numbox_check_minmax(x, x->x_min, x->x_max))
-     {
  	x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
-     }
  }
  
  static void my_numbox_lin(t_my_numbox *x)
! {
!     x->x_lin0_log1 = 0;
! }
! 
! static void my_numbox_init(t_my_numbox *x, t_floatarg f)
! {
!     x->x_gui.x_loadinit = (f==0.0)?0:1;
! }
  
  static void my_numbox_loadbang(t_my_numbox *x)
  {
--- 337,347 ----
      x->x_lin0_log1 = 1;
      if(my_numbox_check_minmax(x, x->x_min, x->x_max))
  	x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
  }
  
  static void my_numbox_lin(t_my_numbox *x)
! {x->x_lin0_log1 = 0;}
  
+ static void my_numbox_init(t_my_numbox *x, t_floatarg f) {x->x_gui.x_loadinit = !!f;}
  static void my_numbox_loadbang(t_my_numbox *x)
  {
***************
*** 412,425 ****
  static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av)
  {
!     if (IS_A_FLOAT(av,0))
!     {
! 	my_numbox_set(x, atom_getfloatarg(0, ac, av));
! 	my_numbox_bang(x);
!     }
  }
  
  static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
  {
!     t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class);
      int bflcol[]={-262144, -1, -1};
      int w=5, h=14;
--- 400,411 ----
  static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av)
  {
!     if (!IS_A_FLOAT(av,0)) return;
!     my_numbox_set(x, atom_getfloatarg(0, ac, av));
!     my_numbox_bang(x);
  }
  
  static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
  {
!     t_my_numbox *x = (t_my_numbox *)iemgui_new(my_numbox_class);
      int bflcol[]={-262144, -1, -1};
      int w=5, h=14;
***************
*** 444,448 ****
      x->x_gui.x_font_style = fstyle;
      x->x_gui.x_draw = (t_iemfunptr)my_numbox_draw;
-     x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
      x->x_val = x->x_gui.x_loadinit ? v : 0.0;
      x->x_lin0_log1 = !!lilo;
--- 430,433 ----
***************
*** 451,456 ****
      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_w = MAX(w,1);
--- 436,440 ----
      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_w = MAX(w,1);
***************
*** 470,475 ****
  static void my_numbox_free(t_my_numbox *x)
  {
!     if(x->x_gui.x_rcv_able)
! 	pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
      clock_free(x->x_clock_reset);
      clock_free(x->x_clock_wait);
--- 454,458 ----
  static void my_numbox_free(t_my_numbox *x)
  {
!     if(x->x_gui.x_rcv_able) pd_unbind((t_pd *)x, x->x_gui.x_rcv);
      clock_free(x->x_clock_reset);
      clock_free(x->x_clock_wait);





More information about the Pd-cvs mailing list