diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 6a5aff148109dd07e463b4657699ebc4f29ef7ba..0cdcfb45176946dfcbae50f5c4cd2de52b31a2d1 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -418,6 +418,7 @@ extern void canvas_apply_setundo(t_canvas *x, t_gobj *y); void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, t_floatarg fflags, t_floatarg deleteit) { + //fprintf(stderr,"================garray_arraydialog\n"); if (deleteit != 0) { //fprintf(stderr,"deleteit\n"); @@ -495,34 +496,8 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, x->x_send = gensym(buf); garray_setsaveit(x, (saveit != 0)); + //fprintf(stderr,"GARRAY_REDRAW\n"); garray_redraw(x); - if (glist_getcanvas(x->x_glist) != x->x_glist) - { - int arrange = 0; - t_gobj *y = glist_getcanvas(x->x_glist)->gl_list; - if (y != (t_gobj *)x->x_glist) { - while (y && y->g_next != (t_gobj *)x->x_glist) { - //fprintf(stderr,"================SEARCHING %s\n", rtext_gettag(glist_findrtext(glist_getcanvas(x->x_glist), pd_checkobject(&y->g_pd)))); - y = y->g_next; - } - arrange = 1; - } - //fprintf(stderr,"================FOUND %s %d\n", rtext_gettag(glist_findrtext(glist_getcanvas(x->x_glist), pd_checkobject(&y->g_pd))), arrange); - char *below = rtext_gettag(glist_findrtext(glist_getcanvas(x->x_glist), pd_checkobject(&y->g_pd))); - glist_noselect(glist_getcanvas(x->x_glist)); - gobj_vis(&x->x_glist->gl_gobj, glist_getcanvas(x->x_glist), 0); - gobj_vis(&x->x_glist->gl_gobj, glist_getcanvas(x->x_glist), 1); - glist_select(glist_getcanvas(x->x_glist), (t_gobj *)x->x_glist); - - if (!arrange) { - sys_vgui(".x%lx.c lower selected\n", glist_getcanvas(x->x_glist)); - //fprintf(stderr,"--------------TOBOTTOM\n"); - } else { - sys_vgui(".x%lx.c lower selected %s\n", glist_getcanvas(x->x_glist), below); - sys_vgui(".x%lx.c raise selected %s\n", glist_getcanvas(x->x_glist), below); - //fprintf(stderr,"++++++++++++++TOMIDDLE\n"); - } - } canvas_dirty(x->x_glist, 1); } } @@ -1212,8 +1187,12 @@ static void garray_doredraw(t_gobj *client, t_glist *glist) garray_vis(&x->x_gobj, x->x_glist, 0); garray_vis(&x->x_gobj, x->x_glist, 1); } + /* we do this to reposition objects back where they belong */ + if (!glist_istoplevel(glist)) { + canvas_restore_original_position(glist_getcanvas(glist), (t_gobj *)glist, 0, -1); + } if (glist_isselected(glist_getcanvas(glist), (t_gobj *)glist)) { - //fprintf(stderr,"yes\n"); + //fprintf(stderr,"garray_doredraw isselected\n"); sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", glist_getcanvas(glist), glist, 1); } } @@ -1223,6 +1202,7 @@ void garray_redraw(t_garray *x) //fprintf(stderr,"garray_redraw\n"); if (glist_isvisible(x->x_glist)) sys_queuegui(&x->x_gobj, x->x_glist, garray_doredraw); + //garray_doredraw(&x->x_gobj, x->x_glist); /* jsarlo { */ /* this happens in garray_vis() when array is visible for performance reasons */ diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index a106d7ec009f491078d68f620843875b939cd351..be2802fe6fe76dce2280efba2daa5faf578124d8 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -251,8 +251,6 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag, t_rtext *yrnxt = NULL, *yr = NULL; int ret = 0; - if (!glist_isselected(x, y) && objtag) - sys_vgui(".x%lx.c addtag selected withtag %s\n", x, objtag); if (y->g_next) { ob = pd_checkobject(&y->g_next->g_pd); } else { @@ -272,48 +270,53 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag, if (ret != 1) { if (dir == -1) { if (yrnxt) { - //fprintf(stderr,"lower\n"); - //if (!sel) - // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 1\n", x, rtext_gettag(yr)); - sys_vgui("pdtk_find_lowest_widget_withtag .x%lx.c %s\n", x, rtext_gettag(yrnxt)); - sys_vgui(".x%lx.c lower selected $::arrange_lowest\n", x); - //if (!sel) - // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 0\n", x, rtext_gettag(yr)); + // lower into middle + if (objtag) + sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag); + else + sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s 0\n", x, rtext_gettag(yrnxt), rtext_gettag(yr)); } else if (x->gl_list == y) { // we get here if we are supposed to go all the way to the bottom - //fprintf(stderr,"lower to the bottom\n"); - sys_vgui(".x%lx.c lower selected\n", x); + if (objtag) + sys_vgui(".x%lx.c addtag arrange withtag %s\n", x, objtag); + else + sys_vgui(".x%lx.c addtag arrange withtag selected\n", x); + sys_vgui(".x%lx.c lower arrange\n", x); + if (objtag) + sys_vgui(".x%lx.c dtag %s arrange\n", x, objtag); + else + sys_vgui(".x%lx.c dtag selected arrange\n", x); } else { // fall back to legacy redraw for objects that are not patchable - //fprintf(stderr,"lower fallback redraw\n"); canvas_redraw(x); ret = -1; } } else { if (yrnxt) { - //fprintf(stderr,"raise\n"); - //if (!sel) - // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 1\n", x, rtext_gettag(yr)); - sys_vgui(".x%lx.c raise selected\n", x); - sys_vgui("pdtk_find_lowest_widget_withtag .x%lx.c %s\n", x, rtext_gettag(yrnxt)); - sys_vgui(".x%lx.c lower selected $::arrange_lowest\n", x); - //if (!sel) - // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 0\n", x, rtext_gettag(yr)); + // raise into middle + if (objtag) + sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag); + else + sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s 0\n", x, rtext_gettag(yrnxt), rtext_gettag(yr)); } else if (y->g_next == NULL) { // we get here if we are supposed to go all the way to the top - //fprintf(stderr,"raise to the top\n"); - sys_vgui(".x%lx.c raise selected\n", x); + if (objtag) + sys_vgui(".x%lx.c addtag arrange withtag %s\n", x, objtag); + else + sys_vgui(".x%lx.c addtag arrange withtag selected\n", x); + sys_vgui(".x%lx.c raise arrange\n", x); + if (objtag) + sys_vgui(".x%lx.c dtag %s arrange\n", x, objtag); + else + sys_vgui(".x%lx.c dtag selected arrange\n", x); sys_vgui(".x%lx.c raise all_cords\n", x); } else { // fall back to legacy redraw for objects that are not patchable - //fprintf(stderr,"raise fallback redraw\n"); canvas_redraw(x); ret = -1; } } } - if (!glist_isselected(x, y) && objtag) - sys_vgui(".x%lx.c dtag %s selected\n", x, objtag); return(ret); } diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index 007dae40ac0ee1c031dd13ad6f16b489e42db810..b4ac53e4a57f76a2cf7ced2b0d85be71baace4f1 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -846,7 +846,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) sys_vgui(".x%lx.c create prect\ %d %d %d %d -stroke $graph_outline -tags {%sR}\n", glist_getcanvas(x->gl_owner), - x1, y1, x2, y2, tag); + x1, y1, x2, y2, tag); // -fill $obj_box_fill /* if there's just one "garray" in the graph, write its name along the top */ @@ -854,13 +854,13 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) if (g->g_pd == garray_class && !garray_getname((t_garray *)g, &arrayname)) { - //i -= sys_fontheight(glist_getfont(x)); - i++; + //i++; sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor nw\ -font {{%s} %d %s} -tags {%s} -fill %s\n", (long)glist_getcanvas(x), x1+2, i, arrayname->s_name, sys_font, sys_hostfontsize(glist_getfont(x)), sys_fontweight, tag, (glist_isselected(x, gr) ? "$select_color" : "$graph_outline")); + i += sys_fontheight(glist_getfont(x)); } /* draw ticks on horizontal borders. If lperb field is diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index 30586f4780896ed73a4aa57eb2bb81312b334827..899af606a37d55282f8316aa524616e877744918 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -207,7 +207,7 @@ static void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) x1--; x2++; y1--; y2++; if (glist_istoplevel(glist)) sys_vgui(".x%lx.c create polyline %d %d %d %d %d %d %d %d %d %d \ - -strokewidth 0 -fill $select_color -tags {select%lx selected}\n", + -strokewidth 1 -stroke $select_color -tags {select%lx selected}\n", glist_getcanvas(glist), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, x); } @@ -220,6 +220,7 @@ static void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) static void scalar_select(t_gobj *z, t_glist *owner, int state) { + //fprintf(stderr,"scalar_select %d\n", state); t_scalar *x = (t_scalar *)z; t_template *tmpl; t_symbol *templatesym = x->sc_template; @@ -238,7 +239,10 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state) if (state) { sys_vgui(".x%lx.c addtag selected withtag scalar%lx\n", glist_getcanvas(owner), x); - if (templatecanvas) { + if (x->sc_vec) + sys_vgui(".x%lx.c addtag selected withtag .x%lx.x%lx.template%lx\n", + glist_getcanvas(owner), glist_getcanvas(owner), owner, x->sc_vec); + /*if (templatecanvas) { // get the universal tag for all nested objects t_canvas *tag = owner; while (tag->gl_owner) { @@ -246,11 +250,13 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state) } sys_vgui(".x%lx.c addtag selected withtag %lx\n", glist_getcanvas(owner), (t_int)tag); - } + }*/ } else { sys_vgui(".x%lx.c dtag scalar%lx selected\n", glist_getcanvas(owner), x); - if (templatecanvas) { + sys_vgui(".x%lx.c dtag .x%lx.x%lx.template%lx selected\n", + glist_getcanvas(owner), glist_getcanvas(owner), owner, x->sc_vec); + /*if (templatecanvas) { // get the universal tag for all nested objects t_canvas *tag = owner; while (tag->gl_owner) { @@ -258,7 +264,7 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state) } sys_vgui(".x%lx.c dtag %lx selected\n", glist_getcanvas(owner), (t_int)tag); - } + }*/ } //sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", glist_getcanvas(owner), owner, state); scalar_drawselectrect(x, owner, state); @@ -363,13 +369,13 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) { int x1 = glist_xtopixels(owner, basex); int y1 = glist_ytopixels(owner, basey); - sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lx scalar%lx}\n", - glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x, x); + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {scalar%lx}\n", + glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x); } else sys_vgui(".x%lx.c delete scalar%lx\n", glist_getcanvas(owner), x); return; } - else sys_vgui(".x%lx.c delete scalar%lx\n", glist_getcanvas(owner), x); + //else sys_vgui(".x%lx.c delete scalar%lx\n", glist_getcanvas(owner), x); for (y = templatecanvas->gl_list; y; y = y->g_next) { @@ -377,13 +383,13 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) if (!wb) continue; (*wb->w_parentvisfn)(y, owner, x->sc_vec, template, basex, basey, vis); } + sys_unqueuegui(x); if (glist_isselected(owner, &x->sc_gobj)) { scalar_select(z, owner, 1); scalar_drawselectrect(x, owner, 0); scalar_drawselectrect(x, owner, 1); } - sys_unqueuegui(x); } static void scalar_doredraw(t_gobj *client, t_glist *glist) @@ -399,7 +405,8 @@ static void scalar_doredraw(t_gobj *client, t_glist *glist) void scalar_redraw(t_scalar *x, t_glist *glist) { if (glist_isvisible(glist)) - sys_queuegui(x, glist, scalar_doredraw); + scalar_doredraw((t_gobj *)x, glist); + //sys_queuegui(x, glist, scalar_doredraw); } extern void template_notifyforscalar(t_template *template, t_glist *owner, diff --git a/pd/src/g_template.c b/pd/src/g_template.c index c70df4126f7264302717f85cd6a94411d72e5f51..4dd481315248427ad39f057fb37e6eacd56a075c 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -1067,7 +1067,6 @@ static void curve_getrect(t_gobj *z, t_glist *glist, if (xloc > x2) x2 = xloc; if (yloc < y1) y1 = yloc; if (yloc > y2) y2 = yloc; - //fprintf(stderr," =====%d %d %d %d\n", x1, y1, x2, y2); } //fprintf(stderr,"FINAL curve_getrect %d %d %d %d\n", x1, y1, x2, y2); *xp1 = x1; @@ -1134,11 +1133,11 @@ static void curve_vis(t_gobj *z, t_glist *glist, int i, n = x->x_npoints; t_fielddesc *f = x->x_vec; - // get the universal tag for all nested objects + /*// get the universal tag for all nested objects t_canvas *tag = x->x_canvas; while (tag->gl_owner) { tag = tag->gl_owner; - } + }*/ /* see comment in plot_vis() */ if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0)) @@ -1184,14 +1183,14 @@ static void curve_vis(t_gobj *z, t_glist *glist, fill, outline); else sys_vgui("-stroke %s\\\n", outline); //if (flags & BEZ) sys_vgui("-smooth 1\\\n"); //this doesn't work with tkpath - sys_vgui("-tags {.x%lx.x%lx.curve%lx %lx}\n", glist_getcanvas(glist), glist, - data, (t_int)tag); + sys_vgui("-tags {.x%lx.x%lx.template%lx}\n", glist_getcanvas(glist), glist, + data); if (!glist_istoplevel(glist)) { t_canvas *gl = glist_getcanvas(glist); //glist_noselect(gl); //glist_select(gl, (t_gobj *)glist); char objtag[64]; - sprintf(objtag, ".x%lx.x%lx.curve%lx", (t_int)gl, (t_int)glist, (t_int)data); + sprintf(objtag, ".x%lx.x%lx.template%lx", (t_int)gl, (t_int)glist, (t_int)data); canvas_restore_original_position(gl, (t_gobj *)glist, objtag, -1); } } @@ -1199,7 +1198,7 @@ static void curve_vis(t_gobj *z, t_glist *glist, } else { - if (n > 1) sys_vgui(".x%lx.c delete .x%lx.x%lx.curve%lx\n", + if (n > 1) sys_vgui(".x%lx.c delete .x%lx.x%lx.template%lx\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data); } @@ -1589,7 +1588,6 @@ static void plot_getrect(t_gobj *z, t_glist *glist, int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); for (i = 0, xsum = 0; i < array->a_n; i += incr) { - //fprintf(stderr," <====plot_getrect %d %d %d %d\n", x1, y1, x2, y2); t_float usexloc, useyloc; t_gobj *y; /* get the coords of the point proper */ @@ -1680,11 +1678,11 @@ static void plot_vis(t_gobj *z, t_glist *glist, int tovis) { t_plot *x = (t_plot *)z; - // get the universal tag for all nested objects + /*// get the universal tag for all nested objects t_canvas *tag = x->x_canvas; while (tag->gl_owner) { tag = tag->gl_owner; - } + }*/ //fprintf(stderr,"===============plot %lx glist %lx glist_getcanvas %lx plot->x_obj %lx plot->x_canvas %lx glist_getcanvas(plot->x_canvas) %lx\n", (t_int)x, (t_int)glist, (t_int)glist_getcanvas(glist), (t_int)&x->x_obj, (t_int)x->x_canvas, (t_int)x->x_canvas->gl_owner); int draw_me = 1; //used for experimental disabling of drawing outside GOP bounds @@ -1768,14 +1766,15 @@ static void plot_vis(t_gobj *z, t_glist *glist, if (draw_me) {*/ //we subtract 1 from y to keep it in sync with the rest of the types of templates sys_vgui( - ".x%lx.c create prect %d %d %d %d -fill black -strokewidth 0 -tags {.x%lx.x%lx.plot%lx %lx}\n", + ".x%lx.c create prect %d %d %d %d -fill black -strokewidth 0 -tags {.x%lx.x%lx.template%lx}\n", glist_getcanvas(glist), ixpix, (int)glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, minyval)) - 1, inextx, (int)(glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, maxyval)) + linewidth) - 1, glist_getcanvas(glist), glist, - data, (t_int)tag); + data); + //} //part of experimental code above ndrawn++; minyval = 1e20; @@ -1869,8 +1868,8 @@ static void plot_vis(t_gobj *z, t_glist *glist, outline); //if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n"); //this doesn't work with tkpath - sys_vgui("-tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), glist, - data, (t_int)tag); + sys_vgui("-tags {.x%lx.x%lx.template%lx}\n", glist_getcanvas(glist), glist, + data); } else if (linewidth > 0) { @@ -1913,7 +1912,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, //sys_vgui("-fill %s\\\n", outline); //if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n"); //this doesn't work with tkpath - sys_vgui("-tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), glist, data, (t_int)tag); + sys_vgui("-tags {.x%lx.x%lx.template%lx}\n", glist_getcanvas(glist), glist, data); } } /* We're done with the outline; now draw all the points. @@ -1945,9 +1944,15 @@ static void plot_vis(t_gobj *z, t_glist *glist, } } if (!glist_istoplevel(glist)) { + t_canvas *gl = glist_getcanvas(glist); + char objtag[64]; + sprintf(objtag, ".x%lx.x%lx.template%lx", (t_int)gl, (t_int)glist, (t_int)data); + canvas_restore_original_position(gl, (t_gobj *)glist, objtag, -1); + } + /* sys_vgui(".x%lx.c lower .x%lx.x%lx.plot%lx %s\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data, rtext_gettag(glist_findrtext(glist_getcanvas(glist), &glist->gl_obj))); sys_vgui(".x%lx.c raise .x%lx.x%lx.plot%lx %s\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data, rtext_gettag(glist_findrtext(glist_getcanvas(glist), &glist->gl_obj))); - } + }*/ } else { @@ -1969,7 +1974,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, } } /* and then the trace */ - sys_vgui(".x%lx.c delete .x%lx.x%lx.plot%lx\n", + sys_vgui(".x%lx.c delete .x%lx.x%lx.template%lx\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data); } } @@ -2183,11 +2188,11 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist, //fprintf(stderr,"drawnumber_vis %d\n", vis); t_drawnumber *x = (t_drawnumber *)z; - // get the universal tag for all nested objects + /*// get the universal tag for all nested objects t_canvas *tag = x->x_canvas; while (tag->gl_owner) { tag = tag->gl_owner; - } + }*/ /* see comment in plot_vis() */ if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0)) @@ -2212,10 +2217,10 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist, glist_getcanvas(glist), xloc, yloc, colorstring, buf); sys_vgui(" -font {{%s} -%d %s}", sys_font, sys_hostfontsize(fontsize), sys_fontweight); - sys_vgui(" -tags {.x%lx.x%lx.drawnumber%lx %lx}\n", - glist_getcanvas(glist), glist, data, (t_int)tag); + sys_vgui(" -tags {.x%lx.x%lx.template%lx}\n", + glist_getcanvas(glist), glist, data); } - else sys_vgui(".x%lx.c delete .x%lx.x%lx.drawnumber%lx\n", glist_getcanvas(glist), + else sys_vgui(".x%lx.c delete .x%lx.x%lx.template%lx\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data); } @@ -2484,7 +2489,7 @@ static void drawsymbol_sprintf(t_drawsymbol *x, char *buf, t_atom *ap) strncpy(buf, x->x_label->s_name, DRAWSYMBOL_BUFSIZE); buf[DRAWSYMBOL_BUFSIZE - 1] = 0; nchars = strlen(buf); - atom_string(ap, buf + nchars, DRAWSYMBOL_BUFSIZE - nchars); + atom_string(ap, buf, DRAWSYMBOL_BUFSIZE); } static void drawsymbol_getrect(t_gobj *z, t_glist *glist, @@ -2548,11 +2553,11 @@ static void drawsymbol_vis(t_gobj *z, t_glist *glist, { t_drawsymbol *x = (t_drawsymbol *)z; - // get the universal tag for all nested objects + /*// get the universal tag for all nested objects t_canvas *tag = x->x_canvas; while (tag->gl_owner) { tag = tag->gl_owner; - } + }*/ /* see comment in plot_vis() */ if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0)) @@ -2577,10 +2582,10 @@ static void drawsymbol_vis(t_gobj *z, t_glist *glist, glist_getcanvas(glist), xloc, yloc, colorstring, buf); sys_vgui(" -font {{%s} -%d %s}", sys_font, sys_hostfontsize(fontsize), sys_fontweight); - sys_vgui(" -tags {.x%lx.x%lx.drawsymbol%lx %lx}\n", - glist_getcanvas(glist), glist, data, (t_int)tag); + sys_vgui(" -tags {.x%lx.x%lx.template%lx}\n", + glist_getcanvas(glist), glist, data); } - else sys_vgui(".x%lx.c delete .x%lx.x%lx.drawsymbol%lx\n", glist_getcanvas(glist), + else sys_vgui(".x%lx.c delete .x%lx.x%lx.template%lx\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data); } diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 995b17bbee96f1c0f28c028c82d1320b848dfc3c..691de9314d07470f28ac341490acb4d6a0dbea80 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -83,10 +83,10 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) canvas, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h, x->x_gui.x_bcol, x, x, x); sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -stroke #%6.6x -tags {%lxX1 %lxTGL %lx text}\n", - canvas, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w, w, + canvas, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1, w, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, x); sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -stroke #%6.6x -tags {%lxX2 %lxTGL %lx text}\n", - canvas, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w, w, + canvas, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w-1, yy+w+1, w, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxTGL %lx text}\n", @@ -133,10 +133,10 @@ void toggle_draw_move(t_toggle *x, t_glist *glist) canvas, x, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h); sys_vgui(".x%lx.c itemconfigure %lxX1 -strokewidth %d\n", canvas, x, w); sys_vgui(".x%lx.c coords %lxX1 %d %d %d %d\n", - canvas, x, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w); + canvas, x, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1); sys_vgui(".x%lx.c itemconfigure %lxX2 -strokewidth %d\n", canvas, x, w); sys_vgui(".x%lx.c coords %lxX2 %d %d %d %d\n", - canvas, x, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w); + canvas, x, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w-1, yy+w+1); sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x, xx+x->x_gui.x_ldx, yy+x->x_gui.x_ldy); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) diff --git a/pd/src/makefile.in b/pd/src/makefile.in index 8b3229ca0fab9c41685b5b13c046e9fd27ab5ae0..363db25e12db47cfd7ace971b442752074a8480b 100644 --- a/pd/src/makefile.in +++ b/pd/src/makefile.in @@ -107,7 +107,7 @@ endif .PHONY: pd gui externs all all: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \ - $(BIN_DIR)/pdreceive externs tkpath + $(BIN_DIR)/pdreceive externs bin: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \ $(BIN_DIR)/pdreceive @@ -197,7 +197,7 @@ tkpath: BINARYMODE=@binarymode@ ABOUT_FILE=$(DESTDIR)$(pddocdir)/1.manual/1.introduction.txt -install: all +install: all tkpath install -d $(DESTDIR)$(libpdbindir) install $(BIN_DIR)/$(GUINAME) $(DESTDIR)$(libpdbindir)/$(GUINAME) install $(BIN_DIR)/pd-watchdog $(DESTDIR)$(libpdbindir)/pd-watchdog diff --git a/pd/src/pd.tk b/pd/src/pd.tk index 0cfd775eced0b7e57b2134b342b220daba6cd8c8..bc6fc0c964f5b5ea45becf2d0fb246fe8879655a 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -3833,13 +3833,16 @@ proc pdtk_canvas_mouseup {name x y b} { # after 100 [list pdtk_canvas_getscroll_ping $name] #} +# we use this to ensure that all gop children are selected for +# optimized displace and other operations without having to redraw +# canvas on every operation proc pdtk_select_all_gop_widgets {name gop state} { #puts stderr "pdtk_select_all_gop_widgets $name $gop $state" foreach item [$name.c find all] { #puts stderr [$name.c gettags $item] foreach tag [$name.c gettags $item] { if { [string first $gop $tag] > -1 } { - #puts stderr ...match + #puts stderr "...match $tag" if {$state} { $name.c addtag selected withtag $tag } else { @@ -3850,23 +3853,59 @@ proc pdtk_select_all_gop_widgets {name gop state} { } } -proc pdtk_find_lowest_widget_withtag {canvas name} { - #puts stderr "...pdtk_find_lowest_widget_withtag $canvas $name" - set ::arrange_lowest 0 +# we use this to restore widgets original position (front to back) +# typically we call this when redrawing +proc pdtk_tag_all_widgets_with_arrange {canvas object state} { + #puts stderr "pdtk_select_all_gop_widgets $canvas $object $state" + foreach item [$canvas find all] { + #puts stderr [$canvas gettags $item] + foreach tag [$canvas gettags $item] { + if { [string first $object $tag] > -1 } { + puts stderr "...tag all match $tag" + if {$state} { + $canvas addtag arrange withtag $tag + } else { + $canvas dtag $tag arrange + } + } + } + } +} + +proc pdtk_find_lowest_widget_withtag_and_arrange {canvas name target objtag} { + #puts stderr "...pdtk_find_lowest_widget_withtag $canvas $name $target $objtag" + set arrange_lowest 0 foreach item [$canvas find all] { #puts stderr "tags=[$canvas gettags $item]" foreach tag [$canvas gettags $item] { if { [string first $name $tag] > -1 } { - #puts stderr ...match - set ::arrange_lowest $tag + #puts stderr "...match $tag" + set arrange_lowest $tag break; } } - if { $::arrange_lowest != 0 } { + if { $arrange_lowest != 0 } { break; } } #puts stderr "final_lowest=$tag" + if { $arrange_lowest != 0 } { + if { $objtag == 0 } { + puts stderr all_widgets + pdtk_tag_all_widgets_with_arrange $canvas $target 1 + } else { + puts stderr one_object + $canvas addtag arrange withtag $objtag + } + $canvas raise arrange + $canvas lower arrange $arrange_lowest + + if { $objtag == 0} { + pdtk_tag_all_widgets_with_arrange $canvas $target 0 + } else { + $canvas dtag $objtag arrange + } + } } proc pdtk_find_highest_widget_withtag {canvas name} {