Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12742
Modified Files:
Tag: devel_0_39
desire.c desire.h
Log Message:
canvas_create_editor is dead.
Index: desire.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v
retrieving revision 1.1.2.32
retrieving revision 1.1.2.33
diff -C2 -d -r1.1.2.32 -r1.1.2.33
*** desire.h 7 Sep 2006 07:15:38 -0000 1.1.2.32
--- desire.h 8 Sep 2006 08:48:32 -0000 1.1.2.33
***************
*** 49,53 ****
/* i don't know whether this is currently used at all in DesireData. -- matju 2006.09 */
! #ifdef GARRAY_THREAD_LOCK
#include <pthread.h> /* TB: for t_garray */
#endif
--- 49,53 ----
/* i don't know whether this is currently used at all in DesireData. -- matju 2006.09 */
! #ifdef GARRAY_THREAD_LOCK
#include <pthread.h> /* TB: for t_garray */
#endif
***************
*** 101,105 ****
unsigned int goprect:1; /* draw rectangle for graph-on-parent */
unsigned int isgraph:1; /* show as graph on parent */
- unsigned int editor:1; /* have an editor */
long next_add; /* insertion point for next call to glist_add (for future use!?) */
t_binbuf *connectbuf; /* connections to deleted objects */
--- 101,104 ----
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.167
retrieving revision 1.1.2.168
diff -C2 -d -r1.1.2.167 -r1.1.2.168
*** desire.c 7 Sep 2006 10:18:51 -0000 1.1.2.167
--- desire.c 8 Sep 2006 08:48:30 -0000 1.1.2.168
***************
*** 470,473 ****
--- 470,475 ----
}
+ t_guiconnect *guiconnect_new(t_pd *who, t_symbol *sym);
+
/* make a new glist. It will either be a "root" canvas or else its parent will be
a "text" object in another window... we don't know which yet. */
***************
*** 479,482 ****
--- 481,485 ----
int xloc = 0, yloc = GLIST_DEFCANVASYLOC;
int font = (owner ? owner->font : sys_defaultfont);
+ char buf[40];
glist_init(x);
x->gl_obj.te_type = T_OBJECT;
***************
*** 523,526 ****
--- 526,532 ----
pd_pushsym((t_pd *)x);
x->next_add = -1;
+ x->connectbuf = binbuf_new();
+ sprintf(buf, ".x%lx", (long)x);
+ x->guiconnect = guiconnect_new((t_pd *)x, gensym(buf));
return x;
}
***************
*** 538,543 ****
}
- static void canvas_create_editor(t_glist *x, int createit);
-
#define GLIST_DEFGRAPHWIDTH 200
#define GLIST_DEFGRAPHHEIGHT 140
--- 544,547 ----
***************
*** 584,588 ****
if (!menu) pd_pushsym((t_pd *)x);
glist_add(g, (t_gobj *)x);
- if (glist_isvisible(g)) canvas_create_editor(x, 1);
return x;
}
--- 588,591 ----
***************
*** 630,702 ****
static void canvas_vis(t_canvas *x, t_floatarg f);
! /* the window becomes "mapped" (visible and not miniaturized) or
! "unmapped" (either miniaturized or just plain gone.) This should be
! called from the GUI after the fact to "notify" us that we're mapped. */
void canvas_map(t_canvas *x, t_floatarg f) {
if (f!=0 && !glist_isvisible(x)) {
- x->mapped = 1;
t_gobj *y;
! if (!x->havewindow) {bug("canvas_map"); canvas_vis(x,1);}
glist_each(y,x) gobj_changed(y,0);
! canvas_drawlines(x);
! if (x->isgraph && x->goprect) canvas_drawredrect(x, 1);
}
if (f==0 && glist_isvisible(x)) {
- x->mapped = 0;
gobj_unsubscribe((t_gobj *)x,(t_gobj *)manager);
}
}
- t_guiconnect *guiconnect_new(t_pd *who, t_symbol *sym);
-
static void guiconnect_notarget(t_guiconnect *x, double timedelay);
! /* recursively create or destroy all editors of a glist and its
! sub-glists, as long as they aren't toplevels. */
!
! static void canvas_create_editor(t_glist *x, int createit) {
! t_gobj *y;
! if (createit) {
! if (x->editor) bug("canvas_create_editor");
! else {
! char buf[40];
! x->editor = 1;
! x->connectbuf = binbuf_new();
! sprintf(buf, ".x%lx", (long)x);
! x->guiconnect = guiconnect_new((t_pd *)x, gensym(buf));
! }
! } else {
! if (!x->editor) bug("canvas_create_editor");
! else {
! x->editor = 0;
! guiconnect_notarget(x->guiconnect, 1000);
! binbuf_free(x->connectbuf);
! }
! }
! glist_each(y,x) {
! if (pd_class(&y->g_pd) == canvas_class && ((t_canvas *)y)->isgraph)
! canvas_create_editor((t_canvas *)y, createit);
! }
! }
!
! /* we call this when we want the window to become visible, mapped, and
! in front of all windows; or with "f" zero, when we want to get rid of the window. */
static void canvas_vis(t_canvas *x, t_floatarg f) {
! if (f && x->editor) sys_mgui(x,"raise","");
! if (f && !x->editor) {
! canvas_create_editor(x, 1);
! x->havewindow = 1;
! gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
! gobj_changed(x,0);
! }
! if (!f && x->editor) {
! sys_mgui(x,"delete_window","");
! canvas_create_editor(x, 0);
! if (glist_isvisible(x)) canvas_map(x, 0);
! /* if we're a graph on our parent and the parent exists and is visible, show ourselves on parent. */
! if (x->isgraph && x->owner) canvas_create_editor(x, 1);
! x->havewindow = 0;
! }
! gobj_changed(x,0);
}
--- 633,663 ----
static void canvas_vis(t_canvas *x, t_floatarg f);
! /* canvas_map(,1) subscribes the client upon canvas_vis(,1) and unminimizing.
! canvas_map(,0) unsubscribes the client upon canvas_vis(,0) and minimizing. */
void canvas_map(t_canvas *x, t_floatarg f) {
if (f!=0 && !glist_isvisible(x)) {
t_gobj *y;
! gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
glist_each(y,x) gobj_changed(y,0);
! gobj_changed(x,0);
! canvas_drawlines(x); /*quoi?*/
! if (x->isgraph && x->goprect) canvas_drawredrect(x, 1); /*perdu*/
}
if (f==0 && glist_isvisible(x)) {
gobj_unsubscribe((t_gobj *)x,(t_gobj *)manager);
}
+ x->mapped = f;
}
static void guiconnect_notarget(t_guiconnect *x, double timedelay);
! /* canvas_vis(,1) makes a canvas client-existing, client-updated, visible, mapped, raised.
! canvas_vis(,0) removes the canvas from the client. contrast with canvas_map.
! for GOPs this is *not* the same as in Miller's */
static void canvas_vis(t_canvas *x, t_floatarg f) {
! if (f && x->havewindow) sys_mgui(x,"raise","");
! if (f && !x->havewindow) canvas_map(x,1);
! if (!f && x->havewindow) {sys_mgui(x,"delete",""); canvas_map(x,0);}
! x->havewindow = f;
}
***************
*** 707,711 ****
if (!gl2) bug("canvas_vis"); /* shouldn't happen but don't get too upset. */
else {
- canvas_create_editor(x,0);
x->havewindow = 1;
gobj_changed(x,0);
--- 668,671 ----
***************
*** 745,748 ****
--- 705,710 ----
gfxstub_deleteforkey(x); /* probably unnecessary */
if (!x->owner) canvas_takeofflist(x);
+ guiconnect_notarget(x->guiconnect, 1000);
+ binbuf_free(x->connectbuf);
}
***************
*** 1229,1239 ****
if (!nogoprect && !x->goprect) {
t_gobj *g;
! glist_each(g,x) if (pd_checkobject(&g->g_pd)) {
! x->goprect = 1;
! break;
! }
}
if (glist_isvisible(x) && x->goprect) glist_redraw(x);
- if (x->loading && x->owner && glist_isvisible(x->owner)) canvas_create_editor(x, 1);
}
}
--- 1191,1197 ----
if (!nogoprect && !x->goprect) {
t_gobj *g;
! glist_each(g,x) if (pd_checkobject(&g->g_pd)) {x->goprect = 1; break;}
}
if (glist_isvisible(x) && x->goprect) glist_redraw(x);
}
}
***************
*** 1377,1383 ****
t_gobj *selhead = 0, *seltail = 0, *nonhead = 0, *nontail = 0, *y, *y2;
t_linetraverser t; t_outconnect *oc;
- t_binbuf *b;
- if (!x->editor) {error("canvas_stowconnections without editor"); return;}
- b = x->connectbuf;
/* split list to "selected" and "unselected" parts */
--- 1335,1338 ----
***************
*** 1396,1403 ****
else x->list = nonhead, nontail->g_next = selhead;
/* add connections to binbuf */
! binbuf_clear(b);
glist_wire_each(oc,t,x) {
if ((o == (t_gobj *)t.from) != (o == (t_gobj *)t.to))
! binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
glist_getindex(x, (t_gobj *)t.from), t.outlet,
glist_getindex(x, (t_gobj *)t.to), t.inlet);
--- 1351,1358 ----
else x->list = nonhead, nontail->g_next = selhead;
/* add connections to binbuf */
! binbuf_clear(x->connectbuf);
glist_wire_each(oc,t,x) {
if ((o == (t_gobj *)t.from) != (o == (t_gobj *)t.to))
! binbuf_addv(x->connectbuf, "ssiiii;", gensym("#X"), gensym("connect"),
glist_getindex(x, (t_gobj *)t.from), t.outlet,
glist_getindex(x, (t_gobj *)t.to), t.inlet);
***************
*** 2387,2391 ****
}
gobj_changed(x,0);
! if (x->editor && x->isgraph && !x->goprect && pd_checkobject(&y->g_pd)) {
x->goprect = 1;
canvas_drawredrect(x, 1);
--- 2342,2346 ----
}
gobj_changed(x,0);
! if (x->isgraph && !x->goprect && pd_checkobject(&y->g_pd)) {
x->goprect = 1;
canvas_drawredrect(x, 1);
***************
*** 3287,3301 ****
int x1=x->screenx1, xs=x->screenx2-x1;
int y1=x->screeny1, ys=x->screeny2-y1;
if (x->owner && !x->env) { /* subpatch */
! binbuf_addv(b, "ssiiiisi;", gensym("#N"), gensym("canvas"), x1, y1, xs, ys,
! *x->name->s_name?x->name:gensym("(subpatch)"), x->mapped);
} else { /* root or abstraction */
! binbuf_addv(b, "ssiiiii;", gensym("#N"), gensym("canvas"), x1, y1, xs, ys, (int)x->font);
}
}
static void canvas_savecoordsto(t_canvas *x, t_binbuf *b) {
! /* unless everything is the default (as in ordinary subpatches)
! print out a "coords" message to set up the coordinate systems */
/*if (!x->isgraph && x->x1==0 && x->y1==0 &&
x->x2==1 && x->y2==1 && x->pixwidth==0 && x->pixheight==0) return;*/
--- 3242,3255 ----
int x1=x->screenx1, xs=x->screenx2-x1;
int y1=x->screeny1, ys=x->screeny2-y1;
+ binbuf_addv(b, "ssiiii", gensym("#N"), gensym("canvas"), x1, y1, xs, ys);
if (x->owner && !x->env) { /* subpatch */
! binbuf_addv(b, "si;", *x->name->s_name?x->name:gensym("(subpatch)"), x->mapped);
} else { /* root or abstraction */
! binbuf_addv(b, "i;", (int)x->font);
}
}
static void canvas_savecoordsto(t_canvas *x, t_binbuf *b) {
! /* if everything is the default, skip saving this line */
/*if (!x->isgraph && x->x1==0 && x->y1==0 &&
x->x2==1 && x->y2==1 && x->pixwidth==0 && x->pixheight==0) return;*/
***************
*** 3335,3340 ****
((t_scalar *)y)->sc_vec, ntemplatesp, templatevecp);
else if (pd_class(&y->g_pd) == canvas_class && wholething)
! canvas_collecttemplatesfor((t_canvas *)y,
! ntemplatesp, templatevecp, 1);
}
}
--- 3289,3293 ----
((t_scalar *)y)->sc_vec, ntemplatesp, templatevecp);
else if (pd_class(&y->g_pd) == canvas_class && wholething)
! canvas_collecttemplatesfor((t_canvas *)y, ntemplatesp, templatevecp, 1);
}
}