Update of /cvsroot/pure-data/externals/ggee/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9670
Modified Files:
envgen.c w_envgen.h
Log Message:
F**ed GOP
Index: envgen.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/gui/envgen.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** envgen.c 6 Feb 2004 17:03:34 -0000 1.8
--- envgen.c 8 Feb 2005 09:28:44 -0000 1.9
***************
*** 313,318 ****
class_addmethod(envgen_class,(t_method)envgen_sustain,gensym("sustain"),A_FLOAT,A_NULL);
- class_addmethod(envgen_class, (t_method)envgen_click, gensym("click"),
- A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
class_addmethod(envgen_class, (t_method)envgen_motion, gensym("motion"),
A_FLOAT, A_FLOAT, 0);
--- 313,316 ----
Index: w_envgen.h
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/gui/w_envgen.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** w_envgen.h 6 Feb 2004 17:03:34 -0000 1.11
--- w_envgen.h 8 Feb 2005 09:28:44 -0000 1.12
***************
*** 8,19 ****
#endif
- #define PD_VERSION_MINOR 32
#define BACKGROUNDCOLOR "grey"
#define BORDER 2
- #if 0 /* backwards compatiblity */
- #define text_xpix(a,b) a.te_xpos
- #define text_ypix(a,b) a.te_ypos
- #endif
static void draw_inlets(t_envgen *x, t_glist *glist, int firsttime, int nin, int nout)
--- 8,14 ----
***************
*** 21,39 ****
int n = nout;
int nplus, i;
nplus = (n == 1 ? 1 : n-1);
for (i = 0; i < n; i++)
{
! int onset = x->x_obj.te_xpix + (x->w.width-2*BORDER) * i / nplus;
if (firsttime)
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n",
glist_getcanvas(glist),
! onset, x->x_obj.te_ypix + x->w.height - 1 + 2*BORDER,
! onset + IOWIDTH, x->x_obj.te_ypix + x->w.height + 2*BORDER,
x, i);
else
sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
! onset, x->x_obj.te_ypix + x->w.height - 1 + 2*BORDER,
! onset + IOWIDTH, x->x_obj.te_ypix + x->w.height + 2*BORDER);
}
n = nin;
--- 16,37 ----
int n = nout;
int nplus, i;
+ int xpos = text_xpix(&x->x_obj,glist);
+ int ypos = text_ypix(&x->x_obj,glist);
+
nplus = (n == 1 ? 1 : n-1);
for (i = 0; i < n; i++)
{
! int onset = xpos + (x->w.width-2*BORDER) * i / nplus;
if (firsttime)
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n",
glist_getcanvas(glist),
! onset, ypos + x->w.height - 1 + 2*BORDER,
! onset + IOWIDTH, ypos + x->w.height + 2*BORDER,
x, i);
else
sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
! onset, ypos + x->w.height - 1 + 2*BORDER,
! onset + IOWIDTH, ypos + x->w.height + 2*BORDER);
}
n = nin;
***************
*** 41,56 ****
for (i = 0; i < n; i++)
{
! int onset = x->x_obj.te_xpix + (x->w.width - IOWIDTH) * i / nplus - BORDER;
if (firsttime)
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n",
glist_getcanvas(glist),
! onset, x->x_obj.te_ypix - BORDER,
! onset + IOWIDTH, x->x_obj.te_ypix + 1 - BORDER,
x, i);
else
sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
! onset, x->x_obj.te_ypix - BORDER,
! onset + IOWIDTH, x->x_obj.te_ypix + 1 - BORDER);
}
--- 39,54 ----
for (i = 0; i < n; i++)
{
! int onset = xpos + (x->w.width - IOWIDTH) * i / nplus - BORDER;
if (firsttime)
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n",
glist_getcanvas(glist),
! onset, ypos - BORDER,
! onset + IOWIDTH, ypos + 1 - BORDER,
x, i);
else
sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
! onset, ypos - BORDER,
! onset + IOWIDTH, ypos + 1 - BORDER);
}
***************
*** 59,63 ****
! static int envgen_next_doodle(t_envgen *x, int xpos,int ypos)
{
int ret = -1;
--- 57,62 ----
! static int envgen_next_doodle(t_envgen *x, struct _glist *glist,
! int xpos,int ypos)
{
int ret = -1;
***************
*** 69,79 ****
int insertpos = -1;
! if (xpos > x->x_obj.te_xpix + x->w.width) xpos = x->x_obj.te_xpix + x->w.width;
xscale = x->w.width/x->duration[x->last_state];
yscale = x->w.height;
! dxpos = x->x_obj.te_xpix;/* + BORDER */;
! dypos = x->x_obj.te_ypix + BORDER;
for (i=0;i<=x->last_state;i++) {
--- 68,79 ----
int insertpos = -1;
! if (xpos > text_xpix(&x->x_obj,glist) + x->w.width)
! xpos = text_xpix(&x->x_obj,glist) + x->w.width;
xscale = x->w.width/x->duration[x->last_state];
yscale = x->w.height;
! dxpos = text_xpix(&x->x_obj,glist);/* + BORDER */;
! dypos = text_ypix(&x->x_obj,glist) + BORDER;
for (i=0;i<=x->last_state;i++) {
***************
*** 111,118 ****
}
else {
! x->w.pointerx = x->x_obj.te_xpix + x->duration[insertpos]*x->w.width/x->duration[x->last_state];
! x->w.pointery = x->x_obj.te_ypix +
(1.f - x->finalvalues[insertpos])*x->w.height;
}
--- 111,118 ----
}
else {
! x->w.pointerx = text_xpix(&x->x_obj,glist) + x->duration[insertpos]*x->w.width/x->duration[x->last_state];
! x->w.pointery = text_ypix(&x->x_obj,glist) +
(1.f - x->finalvalues[insertpos])*x->w.height;
}
***************
*** 132,137 ****
yscale = x->w.height;
! xpos = x->x_obj.te_xpix;
! ypos = (int) (x->x_obj.te_ypix + x->w.height);
for (i=0;i<=x->last_state;i++) {
sprintf(guistr,".x%x.c create oval %d %d %d %d -tags %xD%d",(unsigned int)glist_getcanvas(glist),
--- 132,137 ----
yscale = x->w.height;
! xpos = text_xpix(&x->x_obj,glist);
! ypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height);
for (i=0;i<=x->last_state;i++) {
sprintf(guistr,".x%x.c create oval %d %d %d %d -tags %xD%d",(unsigned int)glist_getcanvas(glist),
***************
*** 173,177 ****
! static void envgen_shownum(t_envgen *x)
{
float xscale,yscale;
--- 173,177 ----
! static void envgen_shownum(t_envgen *x,t_glist* glist)
{
float xscale,yscale;
***************
*** 182,187 ****
yscale = x->w.height;
! xpos = x->x_obj.te_xpix;
! ypos = (int) (x->x_obj.te_ypix + x->w.height);
envgen_delnum(x);
--- 182,187 ----
yscale = x->w.height;
! xpos = text_xpix(&x->x_obj,glist);
! ypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height);
envgen_delnum(x);
***************
*** 209,218 ****
char num[40];
x->w.numclock = clock_new(x, (t_method) envgen_delnum);
sys_vgui(".x%x.c create rectangle \
%d %d %d %d -tags %xS -fill "BACKGROUNDCOLOR"\n",
glist_getcanvas(glist),
! x->x_obj.te_xpix-BORDER, x->x_obj.te_ypix-BORDER,
! x->x_obj.te_xpix + x->w.width+2*BORDER, x->x_obj.te_ypix + x->w.height+2*BORDER,
x);
--- 209,220 ----
char num[40];
+ xpos = text_xpix(&x->x_obj,glist);
+ ypos = (int) text_ypix(&x->x_obj,glist);
x->w.numclock = clock_new(x, (t_method) envgen_delnum);
sys_vgui(".x%x.c create rectangle \
%d %d %d %d -tags %xS -fill "BACKGROUNDCOLOR"\n",
glist_getcanvas(glist),
! xpos-BORDER, ypos-BORDER,
! xpos + x->w.width+2*BORDER, ypos + x->w.height+2*BORDER,
x);
***************
*** 221,229 ****
sprintf(buf,".x%x.c create line",(unsigned int)glist_getcanvas(glist));
- xpos = x->x_obj.te_xpix;
- ypos = (int) (x->x_obj.te_ypix + x->w.height);
for (i=0;i<=x->last_state;i++) {
sprintf(num," %d %d ",(int)(xpos + x->duration[i]*xscale),
! (int)(ypos - x->finalvalues[i]*yscale));
strcat(buf,num);
}
--- 223,229 ----
sprintf(buf,".x%x.c create line",(unsigned int)glist_getcanvas(glist));
for (i=0;i<=x->last_state;i++) {
sprintf(num," %d %d ",(int)(xpos + x->duration[i]*xscale),
! (int)(ypos + x->w.height- x->finalvalues[i]*yscale));
strcat(buf,num);
}
***************
*** 241,252 ****
static char buf[1024];
float xscale,yscale;
- int xpos,ypos;
char num[40];
sys_vgui(".x%x.c coords %xS \
%d %d %d %d\n",
glist_getcanvas(glist), x,
! x->x_obj.te_xpix - BORDER, x->x_obj.te_ypix -BORDER,
! x->x_obj.te_xpix + x->w.width+2*BORDER, x->x_obj.te_ypix + x->w.height+2*BORDER);
--- 241,253 ----
static char buf[1024];
float xscale,yscale;
char num[40];
+ int xpos = text_xpix(&x->x_obj,glist);
+ int ypos = text_ypix(&x->x_obj,glist);
sys_vgui(".x%x.c coords %xS \
%d %d %d %d\n",
glist_getcanvas(glist), x,
! xpos - BORDER, ypos -BORDER,
! xpos + x->w.width+2*BORDER, ypos + x->w.height+2*BORDER);
***************
*** 255,263 ****
sprintf(buf,".x%x.c coords %pP",(unsigned int)glist_getcanvas(glist),x);
! xpos = x->x_obj.te_xpix;
! ypos = (int) (x->x_obj.te_ypix + x->w.height);
for (i=0;i<=x->last_state;i++) {
sprintf(num," %d %d ",(int)(xpos + x->duration[i]*xscale),
! (int) (ypos - x->finalvalues[i]*yscale));
strcat(buf,num);
}
--- 256,263 ----
sprintf(buf,".x%x.c coords %pP",(unsigned int)glist_getcanvas(glist),x);
!
for (i=0;i<=x->last_state;i++) {
sprintf(num," %d %d ",(int)(xpos + x->duration[i]*xscale),
! (int) (ypos + x->w.height - x->finalvalues[i]*yscale));
strcat(buf,num);
}
***************
*** 311,318 ****
width = s->w.width + 2*BORDER;
height = s->w.height + 2*BORDER;
! *xp1 = s->x_obj.te_xpix-BORDER;
! *yp1 = s->x_obj.te_ypix-BORDER;
! *xp2 = s->x_obj.te_xpix + width + 4;
! *yp2 = s->x_obj.te_ypix + height + 4;
}
--- 311,318 ----
width = s->w.width + 2*BORDER;
height = s->w.height + 2*BORDER;
! *xp1 = text_xpix(&s->x_obj,owner)-BORDER;
! *yp1 = text_ypix(&s->x_obj,owner)-BORDER;
! *xp2 = text_xpix(&s->x_obj,owner) + width + 4;
! *yp2 = text_ypix(&s->x_obj,owner) + height + 4;
}
***************
*** 372,385 ****
! static void envgen_followpointer(t_envgen* x)
{
float dur;
-
float xscale = x->duration[x->last_state]/x->w.width;
-
if ((x->w.grabbed > 0) && (x->w.grabbed < x->last_state)) {
! dur = (x->w.pointerx - x->x_obj.te_xpix)*xscale;
if (dur < x->duration[x->w.grabbed-1])
dur = x->duration[x->w.grabbed-1];
--- 372,383 ----
! static void envgen_followpointer(t_envgen* x,t_glist* glist)
{
float dur;
float xscale = x->duration[x->last_state]/x->w.width;
if ((x->w.grabbed > 0) && (x->w.grabbed < x->last_state)) {
! dur = (x->w.pointerx - text_xpix(&x->x_obj,glist))*xscale;
if (dur < x->duration[x->w.grabbed-1])
dur = x->duration[x->w.grabbed-1];
***************
*** 391,395 ****
! x->finalvalues[x->w.grabbed] = 1.0f - (x->w.pointery - (float)x->x_obj.te_ypix)/(float)x->w.height;
if (x->finalvalues[x->w.grabbed] < 0.0)
x->finalvalues[x->w.grabbed]= 0.0;
--- 389,393 ----
! x->finalvalues[x->w.grabbed] = 1.0f - (x->w.pointery - (float)text_ypix(&x->x_obj,glist))/(float)x->w.height;
if (x->finalvalues[x->w.grabbed] < 0.0)
x->finalvalues[x->w.grabbed]= 0.0;
***************
*** 412,421 ****
}
if (!x->resizing)
! envgen_followpointer(x);
else {
x->w.width+=dx;
x->w.height+=dy;
}
! envgen_shownum(x);
envgen_update(x,x->w.glist);
}
--- 410,419 ----
}
if (!x->resizing)
! envgen_followpointer(x,x->w.glist);
else {
x->w.width+=dx;
x->w.height+=dy;
}
! envgen_shownum(x,x->w.glist);
envgen_update(x,x->w.glist);
}
***************
*** 438,479 ****
!
! void envgen_click(t_envgen *x,
! t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl,
! t_floatarg alt)
{
/* check if user wants to resize */
! float wxpos = x->x_obj.te_xpix;
! float wypos = (int) (x->x_obj.te_ypix + x->w.height);
! envgen_next_doodle(x,xpos,ypos);
! #if (PD_VERSION_MINOR > 31)
! glist_grab(x->w.glist, &x->x_obj.te_g, (t_glistmotionfn) envgen_motion,
! (t_glistkeyfn) envgen_key, xpos, ypos);
! #else
! glist_grab(x->w.glist, &x->x_obj.te_g, xpos, ypos);
! #endif
! x->resizing = 0;
! if (x->resizeable && (xpos > wxpos + x->w.width) &&
! (ypos > wypos)) {
! x->resizing = 1;
! return;
! }
! x->w.shift = shift;
! envgen_followpointer(x);
! envgen_shownum(x);
! envgen_update(x,x->w.glist);
! }
! #if (PD_VERSION_MINOR > 31)
! static int envgen_newclick(t_gobj *z, struct _glist *glist,
! int xpix, int ypix, int shift, int alt, int dbl, int doit)
! {
! if (doit)
! envgen_click((t_envgen *)z, (t_floatarg)xpix, (t_floatarg)ypix,
! (t_floatarg)shift, 0, (t_floatarg)alt);
! return (1);
}
- #endif
--- 436,465 ----
! static int envgen_newclick(t_envgen *x, struct _glist *glist,
! int xpos, int ypos, int shift, int alt, int dbl, int doit)
{
/* check if user wants to resize */
! float wxpos = text_xpix(&x->x_obj,glist);
! float wypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height);
! if (doit){
! envgen_next_doodle(x,glist,xpos,ypos);
+ glist_grab(x->w.glist, &x->x_obj.te_g, (t_glistmotionfn) envgen_motion,
+ (t_glistkeyfn) envgen_key, xpos, ypos);
! x->resizing = 0;
! if (x->resizeable && (xpos > wxpos + x->w.width) &&
! (ypos > wypos)) {
! x->resizing = 1;
! return;
! }
!
! x->w.shift = shift;
! envgen_followpointer(x,glist);
! envgen_shownum(x,glist);
! envgen_update(x,glist);
! }
! return (1);
}