Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15890
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
added canvas_savecoordsto
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.146
retrieving revision 1.1.2.147
diff -C2 -d -r1.1.2.146 -r1.1.2.147
*** desire.c 3 Sep 2006 06:01:00 -0000 1.1.2.146
--- desire.c 4 Sep 2006 02:01:12 -0000 1.1.2.147
***************
*** 3602,3605 ****
--- 3602,3621 ----
}
+ 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->gl_isgraph && x->gl_x1==0 && x->gl_y1==0 &&
+ x->gl_x2==1 && x->gl_y2==1 && x->gl_pixwidth==0 && x->gl_pixheight==0) return;*/
+
+ /* if we have a graph-on-parent rectangle, we're new style. The format is arranged so
+ that old versions of Pd can at least do something with it.
+ otherwise write in 0.38-compatible form. */
+ binbuf_addv(b, "ssfffffff", gensym("#X"), gensym("coords"),
+ x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, (float)x->gl_pixwidth, (float)x->gl_pixheight,
+ x->gl_isgraph);
+ if (x->gl_goprect) binbuf_addv(b, "ff", (float)x->gl_xmargin, (float)x->gl_ymargin);
+ binbuf_addv(b,";");
+ }
+
static void canvas_saveto(t_canvas *x, t_binbuf *b) {
t_gobj *y;
***************
*** 3608,3641 ****
canvas_savecontainerto(x,b);
glist_each(y,x) gobj_save(y, b);
-
linetraverser_start(&t, x);
while ((oc = linetraverser_next(&t))) {
! int srcno = canvas_getindex(x, &t.tr_ob->ob_g);
! int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g);
! binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
! srcno, t.tr_outno, sinkno, t.tr_inno);
appendix_save((t_gobj *)oc,b);
}
! /* unless everything is the default (as in ordinary subpatches)
! print out a "coords" message to set up the coordinate systems */
! if (x->gl_isgraph || x->gl_x1 || x->gl_y1 ||
! x->gl_x2 != 1 || x->gl_y2 != 1 || x->gl_pixwidth || x->gl_pixheight)
! {
! if (x->gl_isgraph && x->gl_goprect)
! /* if we have a graph-on-parent rectangle, we're new style.
! The format is arranged so
! that old versions of Pd can at least do something with it. */
! binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"),
! x->gl_x1, x->gl_y1,
! x->gl_x2, x->gl_y2,
! (float)x->gl_pixwidth, (float)x->gl_pixheight,
! 1., (float)x->gl_xmargin, (float)x->gl_ymargin);
! /* otherwise write in 0.38-compatible form */
! else binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"),
! x->gl_x1, x->gl_y1,
! x->gl_x2, x->gl_y2,
! (float)x->gl_pixwidth, (float)x->gl_pixheight,
! (float)x->gl_isgraph);
! }
}
--- 3624,3635 ----
canvas_savecontainerto(x,b);
glist_each(y,x) gobj_save(y, b);
linetraverser_start(&t, x);
while ((oc = linetraverser_next(&t))) {
! int from = canvas_getindex(x, &t.tr_ob->ob_g);
! int to = canvas_getindex(x, &t.tr_ob2->ob_g);
! binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"), from, t.tr_outno, to, t.tr_inno);
appendix_save((t_gobj *)oc,b);
}
! canvas_savecoordsto(x,b);
}
***************
*** 7719,7722 ****
--- 7713,7717 ----
/* just the "#N canvas" line, not the contents */
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);