[PD-cvs] pd/src m_pd.h, 1.4.4.11.2.33.2.2, 1.4.4.11.2.33.2.3 desire.c, 1.1.2.217.2.9, 1.1.2.217.2.10
Mathieu Bouchard
matju at users.sourceforge.net
Sat Dec 2 06:37:24 CET 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2210
Modified Files:
Tag: desiredata
m_pd.h desire.c
Log Message:
shorthands for t_text (removed te_ prefix)
Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.4.4.11.2.33.2.2
retrieving revision 1.4.4.11.2.33.2.3
diff -C2 -d -r1.4.4.11.2.33.2.2 -r1.4.4.11.2.33.2.3
*** m_pd.h 2 Dec 2006 03:12:12 -0000 1.4.4.11.2.33.2.2
--- m_pd.h 2 Dec 2006 05:37:19 -0000 1.4.4.11.2.33.2.3
***************
*** 242,259 ****
typedef struct t_text : t_gobj {
#else
! typedef struct _text /* patchable object - graphical, with text */
{
! t_gobj te_g; /* header for graphical object */
#endif
! t_binbuf *te_binbuf; /* holder for the text */
! t_outlet *te_outlet; /* linked list of outlets */
! t_inlet *te_inlet; /* linked list of inlets */
! short te_xpix; /* x&y location (within the toplevel) */
! short te_ypix;
! short te_width; /* requested width in chars, 0 if auto */
! unsigned int te_type:2; /* from defs below */
! /* t_object is synonym for t_text (LATER unify them) */
} t_text, t_object;
#define T_TEXT 0 /* just a textual comment */
#define T_OBJECT 1 /* a MAX style patchable object */
--- 242,265 ----
typedef struct t_text : t_gobj {
#else
! typedef struct _text /* patchable object - graphical, with text */
{
! t_gobj te_g; /* header for graphical object */
#endif
! t_binbuf *binbuf; /* holder for the text */
! t_outlet *outlet; /* linked list of outlets */
! t_inlet *inlet; /* linked list of inlets */
! short x,y; /* x&y location (within the toplevel) */
! short width; /* requested width in chars, 0 if auto */
! unsigned int type:2; /* from defs below */
} t_text, t_object;
+ #define te_binbuf binbuf
+ #define te_outlet outlet
+ #define te_inlet inlet
+ #define te_xpix x
+ #define te_ypix y
+ #define te_width width
+ #define te_type type
+
#define T_TEXT 0 /* just a textual comment */
#define T_OBJECT 1 /* a MAX style patchable object */
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.9
retrieving revision 1.1.2.217.2.10
diff -C2 -d -r1.1.2.217.2.9 -r1.1.2.217.2.10
*** desire.c 2 Dec 2006 05:10:56 -0000 1.1.2.217.2.9
--- desire.c 2 Dec 2006 05:37:20 -0000 1.1.2.217.2.10
***************
*** 204,208 ****
#ifdef DEBUG_QUEUE
char *buf; int bufn;
! t_binbuf *b = ((t_text *)stuff)->te_binbuf;
if (b) {char *buf; int bufn; binbuf_gettext(b,&buf,&bufn); printf("queue_put [%.*s]\n",bufn,buf);}
else {printf("queue_put (%s)\n",stuff->_class->c_name->s_name);}
--- 204,208 ----
#ifdef DEBUG_QUEUE
char *buf; int bufn;
! t_binbuf *b = ((t_text *)stuff)->binbuf;
if (b) {char *buf; int bufn; binbuf_gettext(b,&buf,&bufn); printf("queue_put [%.*s]\n",bufn,buf);}
else {printf("queue_put (%s)\n",stuff->_class->c_name->s_name);}
***************
*** 223,227 ****
post("queue_get: items in queue: %d",self->len);
if (stuff) {
! t_binbuf *b = ((t_text *)stuff)->te_binbuf;
if (b) {
char *buf; int bufn;
--- 223,227 ----
post("queue_get: items in queue: %d",self->len);
if (stuff) {
! t_binbuf *b = ((t_text *)stuff)->binbuf;
if (b) {
char *buf; int bufn;
***************
*** 521,525 ****
int vis=0, font = owner?owner->font:42 /*sys_defaultfont*/;
canvas_init(x);
! x->te_type = T_OBJECT;
if (!owner) canvas_addtolist(x);
/* toplevel vs subwindow */
--- 521,525 ----
int vis=0, font = owner?owner->font:42 /*sys_defaultfont*/;
canvas_init(x);
! x->type = T_OBJECT;
if (!owner) canvas_addtolist(x);
/* toplevel vs subwindow */
***************
*** 593,597 ****
t_canvas *x = (t_canvas *)pd_new(canvas_class);
canvas_init(x);
! x->te_type = T_OBJECT;
if (!*sym->s_name) {
char buf[40];
--- 593,597 ----
t_canvas *x = (t_canvas *)pd_new(canvas_class);
canvas_init(x);
! x->type = T_OBJECT;
if (!*sym->s_name) {
char buf[40];
***************
*** 613,618 ****
}
x->name = sym;
! x->x1 = x1; x->y1 = y1; x->te_xpix = (short)px1; x->pixwidth = (int)(px2-px1);
! x->x2 = x2; x->y2 = y2; x->te_ypix = (short)py1; x->pixheight = (int)(py2-py1);
x->font = (canvas_getcurrent() ? canvas_getcurrent()->font : 42 /*sys_defaultfont*/);
x->screenx1 = x->screeny1 = 0; x->screenx2 = 450; x->screeny2 = 300;
--- 613,618 ----
}
x->name = sym;
! x->x1 = x1; x->y1 = y1; x->x = (short)px1; x->pixwidth = (int)(px2-px1);
! x->x2 = x2; x->y2 = y2; x->y = (short)py1; x->pixheight = (int)(py2-py1);
x->font = (canvas_getcurrent() ? canvas_getcurrent()->font : 42 /*sys_defaultfont*/);
x->screenx1 = x->screeny1 = 0; x->screenx2 = 450; x->screeny2 = 300;
***************
*** 621,626 ****
x->isgraph = 1;
x->goprect = 0;
! x->te_binbuf = binbuf_new();
! binbuf_addv(x->te_binbuf, "s", gensym("graph"));
if (!menu) pd_pushsym(x);
canvas_add(g,x);
--- 621,626 ----
x->isgraph = 1;
x->goprect = 0;
! x->binbuf = binbuf_new();
! binbuf_addv(x->binbuf, "s", gensym("graph"));
if (!menu) pd_pushsym(x);
canvas_add(g,x);
***************
*** 937,942 ****
/* return true if the "canvas" object is a "table". */
int canvas_istable(t_canvas *x) {
! t_atom *argv = x->te_binbuf ? binbuf_getvec( x->te_binbuf) : 0;
! int argc = x->te_binbuf ? binbuf_getnatom(x->te_binbuf) : 0;
return argc && argv[0].a_type == A_SYMBOL && argv[0].a_w.w_symbol == gensym("table");
}
--- 937,942 ----
/* return true if the "canvas" object is a "table". */
int canvas_istable(t_canvas *x) {
! t_atom *argv = x->binbuf ? binbuf_getvec( x->binbuf) : 0;
! int argc = x->binbuf ? binbuf_getnatom(x->binbuf) : 0;
return argc && argv[0].a_type == A_SYMBOL && argv[0].a_w.w_symbol == gensym("table");
}
***************
*** 945,950 ****
object. This is true for abstractions but also for "table"s... */
static int canvas_showtext(t_canvas *x) {
! t_atom *argv = x->te_binbuf? binbuf_getvec( x->te_binbuf) : 0;
! int argc = x->te_binbuf? binbuf_getnatom(x->te_binbuf) : 0;
int isarray = argc && argv[0].a_type == A_SYMBOL && argv[0].a_w.w_symbol == gensym("graph");
return !isarray;
--- 945,950 ----
object. This is true for abstractions but also for "table"s... */
static int canvas_showtext(t_canvas *x) {
! t_atom *argv = x->binbuf? binbuf_getvec( x->binbuf) : 0;
! int argc = x->binbuf? binbuf_getnatom(x->binbuf) : 0;
int isarray = argc && argv[0].a_type == A_SYMBOL && argv[0].a_w.w_symbol == gensym("graph");
return !isarray;
***************
*** 1101,1106 ****
t_object *ob = pd_checkobject(g);
t_atom *argv;
! if (!ob || ob->te_type != T_OBJECT || binbuf_getnatom(ob->te_binbuf) < 2) continue;
! argv = binbuf_getvec(ob->te_binbuf);
if (argv[0].a_type != A_SYMBOL || argv[1].a_type != A_SYMBOL || argv[0].a_w.w_symbol != s1)
continue;
--- 1101,1106 ----
t_object *ob = pd_checkobject(g);
t_atom *argv;
! if (!ob || ob->type != T_OBJECT || binbuf_getnatom(ob->binbuf) < 2) continue;
! argv = binbuf_getvec(ob->binbuf);
if (argv[0].a_type != A_SYMBOL || argv[1].a_type != A_SYMBOL || argv[0].a_w.w_symbol != s1)
continue;
***************
*** 1204,1208 ****
else
sys_vgui(".x%lx.c create text %d %d -anchor sw -text \"%s\" -tags y\n",
! (t_int)x, xpos, ypos-4,inlet_tip(ob->te_inlet,closest));
*/
}
--- 1204,1208 ----
else
sys_vgui(".x%lx.c create text %d %d -anchor sw -text \"%s\" -tags y\n",
! (t_int)x, xpos, ypos-4,inlet_tip(ob->inlet,closest));
*/
}
***************
*** 1390,1394 ****
static int is_dummy (t_text *x) {
! return x->_class==text_class && x->te_type==T_OBJECT;}
void canvas_connect(t_canvas *x, t_floatarg ffrom, t_floatarg foutlet, t_floatarg fto,t_floatarg finlet) {
--- 1390,1394 ----
static int is_dummy (t_text *x) {
! return x->_class==text_class && x->type==T_OBJECT;}
void canvas_connect(t_canvas *x, t_floatarg ffrom, t_floatarg foutlet, t_floatarg fto,t_floatarg finlet) {
***************
*** 2261,2265 ****
} else {
char *buf; int bufn;
! t_binbuf *bb = ((t_text *)y)->te_binbuf;
if (bb->b_vec) {
binbuf_gettext(bb,&buf,&bufn);
--- 2261,2265 ----
} else {
char *buf; int bufn;
! t_binbuf *bb = ((t_text *)y)->binbuf;
if (bb->b_vec) {
binbuf_gettext(bb,&buf,&bufn);
***************
*** 2442,2446 ****
for (vp = vec, xmax = -0x7fffffff, maxp = 0, j=n; j--; vp++) {
if (!*vp) continue;
! x1 = ((t_text *)*vp)->te_xpix;
if (x1 > xmax) {xmax = x1; maxp = vp;}
}
--- 2442,2446 ----
for (vp = vec, xmax = -0x7fffffff, maxp = 0, j=n; j--; vp++) {
if (!*vp) continue;
! x1 = ((t_text *)*vp)->x;
if (x1 > xmax) {xmax = x1; maxp = vp;}
}
***************
*** 2463,2467 ****
for (vp = vec, xmax = -0x7fffffff, maxp = 0, j=n; j--; vp++) {
if (!*vp) continue;
! x1 = ((t_text *)*vp)->te_xpix;
if (x1 > xmax) {xmax = x1; maxp = vp;}
}
--- 2463,2467 ----
for (vp = vec, xmax = -0x7fffffff, maxp = 0, j=n; j--; vp++) {
if (!*vp) continue;
! x1 = ((t_text *)*vp)->x;
if (x1 > xmax) {xmax = x1; maxp = vp;}
}
***************
*** 2552,2564 ****
static int text_xpix(t_text *x, t_canvas *canvas) {
float width = canvas->x2-canvas->x1;
! if (canvas->havewindow || !canvas->isgraph) return x->te_xpix;
! if (canvas->goprect) return canvas->te_xpix + x->te_xpix - canvas->xmargin;
! return canvas_xtopixels(canvas, canvas->x1 + width * x->te_xpix / (canvas->screenx2-canvas->screenx1));
}
static int text_ypix(t_text *x, t_canvas *canvas) {
float height = canvas->y2-canvas->y1;
! if (canvas->havewindow || !canvas->isgraph) return x->te_ypix;
! if (canvas->goprect) return canvas->te_ypix + x->te_ypix - canvas->ymargin;
! return canvas_ytopixels(canvas, canvas->y1 + height* x->te_ypix / (canvas->screeny2-canvas->screeny1));
}
--- 2552,2564 ----
static int text_xpix(t_text *x, t_canvas *canvas) {
float width = canvas->x2-canvas->x1;
! if (canvas->havewindow || !canvas->isgraph) return x->x;
! if (canvas->goprect) return canvas->x+x->x-canvas->xmargin;
! return canvas_xtopixels(canvas, canvas->x1 + width * x->x / (canvas->screenx2-canvas->screenx1));
}
static int text_ypix(t_text *x, t_canvas *canvas) {
float height = canvas->y2-canvas->y1;
! if (canvas->havewindow || !canvas->isgraph) return x->y;
! if (canvas->goprect) return canvas->y+x->y-canvas->ymargin;
! return canvas_ytopixels(canvas, canvas->y1 + height* x->y / (canvas->screeny2-canvas->screeny1));
}
***************
*** 5985,5998 ****
t_text *x = (t_text *)pd_new(text_class);
t_atom at;
! x->te_width = 0;
! x->te_type = T_TEXT;
! x->te_binbuf = binbuf_new();
if (argc > 1) {
! x->te_xpix = atom_getintarg(0, argc, argv);
! x->te_ypix = atom_getintarg(1, argc, argv);
! if (argc > 2) binbuf_restore(x->te_binbuf, argc-2, argv+2);
else {
SETSYMBOL(&at, gensym("comment"));
! binbuf_restore(x->te_binbuf, 1, &at);
}
canvas_add(gl,x);
--- 5985,5998 ----
t_text *x = (t_text *)pd_new(text_class);
t_atom at;
! x->width = 0;
! x->type = T_TEXT;
! x->binbuf = binbuf_new();
if (argc > 1) {
! x->x = atom_getintarg(0, argc, argv);
! x->y = atom_getintarg(1, argc, argv);
! if (argc > 2) binbuf_restore(x->binbuf, argc-2, argv+2);
else {
SETSYMBOL(&at, gensym("comment"));
! binbuf_restore(x->binbuf, 1, &at);
}
canvas_add(gl,x);
***************
*** 6001,6007 ****
SETSYMBOL(&at, gensym("comment"));
xpix=ypix=0;
! x->te_xpix = (int)canvas_pixelstox(gl, xpix-3);
! x->te_ypix = (int)canvas_pixelstoy(gl, ypix-3);
! binbuf_restore(x->te_binbuf, 1, &at);
canvas_add(gl,x);
}
--- 6001,6007 ----
SETSYMBOL(&at, gensym("comment"));
xpix=ypix=0;
! x->x = (int)canvas_pixelstox(gl, xpix-3);
! x->y = (int)canvas_pixelstoy(gl, ypix-3);
! binbuf_restore(x->binbuf, 1, &at);
canvas_add(gl,x);
}
***************
*** 6034,6042 ****
}
if (!x) x = (t_text *)pd_new(text_class);
! x->te_binbuf = b;
! x->te_xpix = xpix;
! x->te_ypix = ypix;
! x->te_width = 0;
! x->te_type = T_OBJECT;
canvas_add(gl,x);
if (x->_class== vinlet_class) canvas_resortinlets(canvas_getcanvas(gl));
--- 6034,6042 ----
}
if (!x) x = (t_text *)pd_new(text_class);
! x->binbuf = b;
! x->x = xpix;
! x->y = ypix;
! x->width = 0;
! x->type = T_OBJECT;
canvas_add(gl,x);
if (x->_class== vinlet_class) canvas_resortinlets(canvas_getcanvas(gl));
***************
*** 6070,6079 ****
void canvas_objfor(t_canvas *gl, t_text *x, int argc, t_atom *argv) {
! x->te_width = 0;
! x->te_type = T_OBJECT;
! x->te_binbuf = binbuf_new();
! x->te_xpix = atom_getintarg(0, argc, argv);
! x->te_ypix = atom_getintarg(1, argc, argv);
! if (argc > 2) binbuf_restore(x->te_binbuf, argc-2, argv+2);
canvas_add(gl,x);
}
--- 6070,6079 ----
void canvas_objfor(t_canvas *gl, t_text *x, int argc, t_atom *argv) {
! x->width = 0;
! x->type = T_OBJECT;
! x->binbuf = binbuf_new();
! x->x = atom_getintarg(0, argc, argv);
! x->y = atom_getintarg(1, argc, argv);
! if (argc > 2) binbuf_restore(x->binbuf, argc-2, argv+2);
canvas_add(gl,x);
}
***************
*** 6098,6120 ****
static void message_bang(t_message *x)
! {binbuf_eval(x->te_binbuf, &x->mresp.mr_pd, 0, 0);}
static void message_float(t_message *x, t_float f)
! {t_atom at; SETFLOAT(&at, f); binbuf_eval(x->te_binbuf, &x->mresp.mr_pd, 1, &at);}
static void message_symbol(t_message *x, t_symbol *s)
! {t_atom at; SETSYMBOL(&at, s); binbuf_eval(x->te_binbuf, &x->mresp.mr_pd, 1, &at);}
static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_eval(x->te_binbuf, &x->mresp.mr_pd, argc, argv);}
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->te_binbuf, argc, argv); gobj_changed(x,0);}
static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_clear(x->te_binbuf); message_add2(x,s,argc,argv);}
static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->te_binbuf, argc, argv); binbuf_addsemi(x->te_binbuf); gobj_changed(x,0);}
static void message_addcomma(t_message *x)
! {t_atom a; SETCOMMA(&a); binbuf_add(x->te_binbuf, 1, &a); gobj_changed(x,0);}
static void message_adddollar(t_message *x, t_floatarg f)
! {t_atom a; SETDOLLAR(&a, f<0?0:(int)f); binbuf_add(x->te_binbuf, 1, &a); gobj_changed(x,0);}
static void message_adddollsym(t_message *x, t_symbol *s)
! {t_atom a; SETDOLLSYM(&a, s); binbuf_add(x->te_binbuf, 1, &a); gobj_changed(x,0);}
static void message_addsemi(t_message *x) {message_add(x,0,0,0);}
--- 6098,6120 ----
static void message_bang(t_message *x)
! {binbuf_eval(x->binbuf, &x->mresp.mr_pd, 0, 0);}
static void message_float(t_message *x, t_float f)
! {t_atom at; SETFLOAT(&at, f); binbuf_eval(x->binbuf, &x->mresp.mr_pd, 1, &at);}
static void message_symbol(t_message *x, t_symbol *s)
! {t_atom at; SETSYMBOL(&at, s); binbuf_eval(x->binbuf, &x->mresp.mr_pd, 1, &at);}
static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_eval(x->binbuf, &x->mresp.mr_pd, argc, argv);}
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->binbuf, argc, argv); gobj_changed(x,0);}
static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_clear(x->binbuf); message_add2(x,s,argc,argv);}
static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->binbuf, argc, argv); binbuf_addsemi(x->binbuf); gobj_changed(x,0);}
static void message_addcomma(t_message *x)
! {t_atom a; SETCOMMA(&a); binbuf_add(x->binbuf, 1, &a); gobj_changed(x,0);}
static void message_adddollar(t_message *x, t_floatarg f)
! {t_atom a; SETDOLLAR(&a, f<0?0:(int)f); binbuf_add(x->binbuf, 1, &a); gobj_changed(x,0);}
static void message_adddollsym(t_message *x, t_symbol *s)
! {t_atom a; SETDOLLSYM(&a, s); binbuf_add(x->binbuf, 1, &a); gobj_changed(x,0);}
static void message_addsemi(t_message *x) {message_add(x,0,0,0);}
***************
*** 6124,6139 ****
x->mresp.mr_pd._class = mresp_class;
x->mresp.outlet = outlet_new(x,&s_float);
! x->te_width = 0; /* don't know it yet. */
! x->te_type = T_MESSAGE;
! x->te_binbuf = binbuf_new();
x->canvas = gl;
if (argc > 1) {
! x->te_xpix = atom_getintarg(0, argc, argv);
! x->te_ypix = atom_getintarg(1, argc, argv);
! if (argc > 2) binbuf_restore(x->te_binbuf, argc-2, argv+2);
canvas_add(gl,x);
} else {
! x->te_xpix = 0;
! x->te_ypix = 0;
canvas_add(gl,x);
}
--- 6124,6139 ----
x->mresp.mr_pd._class = mresp_class;
x->mresp.outlet = outlet_new(x,&s_float);
! x->width = 0; /* don't know it yet. */
! x->type = T_MESSAGE;
! x->binbuf = binbuf_new();
x->canvas = gl;
if (argc > 1) {
! x->x = atom_getintarg(0, argc, argv);
! x->y = atom_getintarg(1, argc, argv);
! if (argc > 2) binbuf_restore(x->binbuf, argc-2, argv+2);
canvas_add(gl,x);
} else {
! x->x = 0;
! x->y = 0;
canvas_add(gl,x);
}
***************
*** 6185,6189 ****
static void gatom_bang(t_gatom *x) {
t_symbol *s = x->expanded_to;
! t_outlet *o = x->te_outlet;
if (x->atom.a_type == A_FLOAT) {
if (o) outlet_float(o, x->atom.a_w.w_float);
--- 6185,6189 ----
static void gatom_bang(t_gatom *x) {
t_symbol *s = x->expanded_to;
! t_outlet *o = x->outlet;
if (x->atom.a_type == A_FLOAT) {
if (o) outlet_float(o, x->atom.a_w.w_float);
***************
*** 6219,6223 ****
if (x->min>=x->max) x->min=x->max=0;
CLAMP(width,1,80);
! x->te_width = width;
x->wherelabel = (int)wherelabel&3;
if (*x->rcv->s_name) pd_unbind(x, canvas_realizedollar(x->canvas, x->rcv));
--- 6219,6223 ----
if (x->min>=x->max) x->min=x->max=0;
CLAMP(width,1,80);
! x->width = width;
x->wherelabel = (int)wherelabel&3;
if (*x->rcv->s_name) pd_unbind(x, canvas_realizedollar(x->canvas, x->rcv));
***************
*** 6232,6246 ****
void canvas_atom(t_canvas *gl, t_atomtype type, t_symbol *s, int argc, t_atom *argv) {
t_gatom *x = (t_gatom *)pd_new(gatom_class);
! if (type == A_FLOAT) {x->te_width = 5; SETFLOAT(&x->atom, 0);}
! else {x->te_width = 10; SETSYMBOL(&x->atom, &s_symbol);}
! x->te_type = T_ATOM;
x->canvas = gl;
x->min = x->max = 0;
x->wherelabel = 0;
x->label = x->rcv = x->snd = x->expanded_to = &s_;
! x->te_binbuf = binbuf_new();
! binbuf_add(x->te_binbuf, 1, &x->atom);
! x->te_xpix = atom_getintarg(0, argc, argv);
! x->te_ypix = atom_getintarg(1, argc, argv);
inlet_new(x,x,0,0);
outlet_new(x, type == A_FLOAT ? &s_float: &s_symbol);
--- 6232,6246 ----
void canvas_atom(t_canvas *gl, t_atomtype type, t_symbol *s, int argc, t_atom *argv) {
t_gatom *x = (t_gatom *)pd_new(gatom_class);
! if (type == A_FLOAT) {x->width = 5; SETFLOAT(&x->atom, 0);}
! else {x->width = 10; SETSYMBOL(&x->atom, &s_symbol);}
! x->type = T_ATOM;
x->canvas = gl;
x->min = x->max = 0;
x->wherelabel = 0;
x->label = x->rcv = x->snd = x->expanded_to = &s_;
! x->binbuf = binbuf_new();
! binbuf_add(x->binbuf, 1, &x->atom);
! x->x = atom_getintarg(0, argc, argv);
! x->y = atom_getintarg(1, argc, argv);
inlet_new(x,x,0,0);
outlet_new(x, type == A_FLOAT ? &s_float: &s_symbol);
***************
*** 6262,6290 ****
t_text *x = (t_text *)z;
t_canvas *c = (t_canvas *)z; /* in case it is */
! if (x->te_type == T_OBJECT) {
if (zgetfn(x,gensym("saveto")) &&
!(x->_class==canvas_class && (canvas_isabstraction(c) || canvas_istable(c)))) {
mess1(x,gensym("saveto"),b);
! binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->te_xpix, (t_int)x->te_ypix);
} else {
! binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (t_int)x->te_xpix, (t_int)x->te_ypix);
}
! if (x->te_binbuf) {
! binbuf_addbinbuf(b, x->te_binbuf);
} else {
/*bug("binbuf missing at #X restore !!!");*/
}
! } else if (x->te_type == T_MESSAGE) {
! binbuf_addv(b, "ssii", gensym("#X"), gensym("msg"), (t_int)x->te_xpix, (t_int)x->te_ypix);
! binbuf_addbinbuf(b, x->te_binbuf);
! } else if (x->te_type == T_ATOM) {
t_gatom *g = (t_gatom *)x;
t_symbol *sel = g->atom.a_type==A_SYMBOL? gensym("symbolatom") : gensym("floatatom");
! binbuf_addv(b, "ssii", gensym("#X"), sel, (t_int)x->te_xpix, (t_int)x->te_ypix);
! binbuf_addv(b, "iffi", (t_int)x->te_width, g->min, g->max, (t_int)g->wherelabel);
binbuf_addv(b, "sss", gatom_escapit(g->label), gatom_escapit(g->rcv), gatom_escapit(g->snd));
} else { /* comment */
! binbuf_addv(b, "ssii", gensym("#X"), gensym("text"), (t_int)x->te_xpix, (t_int)x->te_ypix);
! binbuf_addbinbuf(b, x->te_binbuf);
}
binbuf_addv(b, ";");
--- 6262,6290 ----
t_text *x = (t_text *)z;
t_canvas *c = (t_canvas *)z; /* in case it is */
! if (x->type == T_OBJECT) {
if (zgetfn(x,gensym("saveto")) &&
!(x->_class==canvas_class && (canvas_isabstraction(c) || canvas_istable(c)))) {
mess1(x,gensym("saveto"),b);
! binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->x, (t_int)x->y);
} else {
! binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (t_int)x->x, (t_int)x->y);
}
! if (x->binbuf) {
! binbuf_addbinbuf(b, x->binbuf);
} else {
/*bug("binbuf missing at #X restore !!!");*/
}
! } else if (x->type == T_MESSAGE) {
! binbuf_addv(b, "ssii", gensym("#X"), gensym("msg"), (t_int)x->x, (t_int)x->y);
! binbuf_addbinbuf(b, x->binbuf);
! } else if (x->type == T_ATOM) {
t_gatom *g = (t_gatom *)x;
t_symbol *sel = g->atom.a_type==A_SYMBOL? gensym("symbolatom") : gensym("floatatom");
! binbuf_addv(b, "ssii", gensym("#X"), sel, (t_int)x->x, (t_int)x->y);
! binbuf_addv(b, "iffi", (t_int)x->width, g->min, g->max, (t_int)g->wherelabel);
binbuf_addv(b, "sss", gatom_escapit(g->label), gatom_escapit(g->rcv), gatom_escapit(g->snd));
} else { /* comment */
! binbuf_addv(b, "ssii", gensym("#X"), gensym("text"), (t_int)x->x, (t_int)x->y);
! binbuf_addbinbuf(b, x->binbuf);
}
binbuf_addv(b, ";");
***************
*** 6292,6299 ****
static void text_setto(t_text *x, t_canvas *canvas, char *buf, int bufsize) {
! if (x->te_type == T_OBJECT) {
t_binbuf *b = binbuf_new();
binbuf_text(b, buf, bufsize);
! int natom1 = binbuf_getnatom(x->te_binbuf); t_atom *vec1 = binbuf_getvec(x->te_binbuf);
int natom2 = binbuf_getnatom(b); t_atom *vec2 = binbuf_getvec(b);
/* special case: if pd args change just pass the message on. */
--- 6292,6299 ----
static void text_setto(t_text *x, t_canvas *canvas, char *buf, int bufsize) {
! if (x->type == T_OBJECT) {
t_binbuf *b = binbuf_new();
binbuf_text(b, buf, bufsize);
! int natom1 = binbuf_getnatom(x->binbuf); t_atom *vec1 = binbuf_getvec(x->binbuf);
int natom2 = binbuf_getnatom(b); t_atom *vec2 = binbuf_getvec(b);
/* special case: if pd args change just pass the message on. */
***************
*** 6302,6309 ****
vec2[0].a_type == A_SYMBOL && vec2[0].a_w.w_symbol == s_pd) {
typedmess(x,gensym("rename"),natom2-1,vec2+1);
! binbuf_free(x->te_binbuf);
! x->te_binbuf = b;
} else {
! int xwas = x->te_xpix, ywas = x->te_ypix;
t_binbuf *buf = canvas_stowconnections(canvas_getcanvas(canvas),x);
canvas_delete(canvas,x);
--- 6302,6309 ----
vec2[0].a_type == A_SYMBOL && vec2[0].a_w.w_symbol == s_pd) {
typedmess(x,gensym("rename"),natom2-1,vec2+1);
! binbuf_free(x->binbuf);
! x->binbuf = b;
} else {
! int xwas=x->x, ywas=x->y;
t_binbuf *buf = canvas_stowconnections(canvas_getcanvas(canvas),x);
canvas_delete(canvas,x);
***************
*** 6313,6317 ****
canvas_restoreconnections(canvas_getcanvas(canvas), buf);
}
! } else binbuf_text(x->te_binbuf, buf, bufsize);
}
--- 6313,6317 ----
canvas_restoreconnections(canvas_getcanvas(canvas), buf);
}
! } else binbuf_text(x->binbuf, buf, bufsize);
}
***************
*** 6330,6335 ****
t_text *o;
if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
! o->te_xpix = (int)px;
! o->te_ypix = (int)py;
gobj_changed(o,0);
}
--- 6330,6335 ----
t_text *o;
if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
! o->x = (int)px;
! o->y = (int)py;
gobj_changed(o,0);
}
***************
*** 6467,6477 ****
}
static void iemgui_delta(t_iemgui *x, t_symbol *s, int ac, t_atom *av) {
! x->te_xpix += (int)atom_getintarg(0, ac, av);
! x->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->te_xpix = (int)atom_getintarg(0, ac, av);
! x->te_ypix = (int)atom_getintarg(1, ac, av);
iemgui_size(x);
}
--- 6467,6477 ----
}
static void iemgui_delta(t_iemgui *x, t_symbol *s, int ac, t_atom *av) {
! x->x += (int)atom_getintarg(0, ac, av);
! x->y += (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->x = (int)atom_getintarg(0, ac, av);
! x->y = (int)atom_getintarg(1, ac, av);
iemgui_size(x);
}
***************
*** 6602,6607 ****
static int pd_savehead(t_binbuf *b, t_iemgui *x, char *name) {
! binbuf_addv(b, "ssiis", gensym("#X"),gensym("obj"),
! (t_int)x->te_xpix, (t_int)x->te_ypix, gensym(name));
return 1;
}
--- 6602,6606 ----
static int pd_savehead(t_binbuf *b, t_iemgui *x, char *name) {
! binbuf_addv(b, "ssiis", gensym("#X"), gensym("obj"), (t_int)x->x, (t_int)x->y, gensym(name));
return 1;
}
***************
*** 6617,6624 ****
canvas_savecontainerto((t_canvas *)self,b);
canvas_savecoordsto((t_canvas *)self,b); /* this may be too early */
! binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"),
! (t_int)x->te_xpix, (t_int)x->te_ypix);
! if (x->te_binbuf) {
! binbuf_addbinbuf(b, x->te_binbuf);
} else {
/*bug("binbuf missing at #X restore !!!");*/
--- 6616,6622 ----
canvas_savecontainerto((t_canvas *)self,b);
canvas_savecoordsto((t_canvas *)self,b); /* this may be too early */
! binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->x, (t_int)x->y);
! if (x->binbuf) {
! binbuf_addbinbuf(b, x->binbuf);
} else {
/*bug("binbuf missing at #X restore !!!");*/
***************
*** 6652,6656 ****
sys_mgui(self,"folder=","s",canvas_getenv(can)->dir);
}
! if (x->te_type == T_ATOM) {
t_gatom *g = (t_gatom *)x;
if (g->atom.a_type==A_SYMBOL) {
--- 6650,6654 ----
sys_mgui(self,"folder=","s",canvas_getenv(can)->dir);
}
! if (x->type == T_ATOM) {
t_gatom *g = (t_gatom *)x;
if (g->atom.a_type==A_SYMBOL) {
***************
*** 6742,6746 ****
void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
t_atom foo;
! t_binbuf *buf = x->te_binbuf;
if (!buf) return;
binbuf_clear(buf);
--- 6740,6744 ----
void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
t_atom foo;
! t_binbuf *buf = x->binbuf;
if (!buf) return;
binbuf_clear(buf);
More information about the Pd-cvs
mailing list