diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index ea1406cd12e4d5b179ad7137df9163bbd08d1b03..bb8b98d1bee987b8900a62931b38c96ca027fa22 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -1052,6 +1052,9 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) tag, x1, y1, x2, y2); if (glist_isselected(parent_glist, gr)) gobj_select(gr, parent_glist, 1); + // here we check for changes in scrollbar because of legacy + // objects that can fall outside gop window, e.g. scalars + canvas_getscroll(glist_getcanvas(x->gl_owner)); //fprintf(stderr,"******************graph_vis SELECT\n"); } else @@ -1063,6 +1066,9 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) glist_eraseiofor(parent_glist, &x->gl_obj, tag); for (g = x->gl_list; g; g = g->g_next) gobj_vis(g, x, 0); + // here we check for changes in scrollbar because of legacy + // objects that can fall outside gop window, e.g. scalars + canvas_getscroll(glist_getcanvas(x->gl_owner)); } } diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index f485fbf277e93d037a3289181d3d092d16d4f2e7..c02fddfc364ec9505bdbd1acd5467b70a387bede 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -354,6 +354,8 @@ void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b) } else newone->g_next = x->gl_list, x->gl_list = newone; } + // here we check for changes in scrollbar due to potential repositioning + canvas_getscroll(x); didit: ; } diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index ab8315f153f899a2a8c84e6b24f7962f0e4d5f34..e650e03e10364c98fabd4d11c918ebe63dd4924e 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -473,14 +473,29 @@ void scalar_select(t_gobj *z, t_glist *owner, int state) glist_getcanvas(owner), x); sys_vgui(".x%lx.c addtag scalar_selected withtag {.scalar%lx}\n", glist_getcanvas(owner), x->sc_vec); + if (x->sc_selected != glist_getcanvas(owner)) + { + // we are inside gop + sys_vgui(".x%lx.c addtag scalarGOP withtag blankscalar%lx\n", + glist_getcanvas(owner), x); + sys_vgui(".x%lx.c addtag scalarGOP withtag {.scalar%lx}\n", + glist_getcanvas(owner), x->sc_vec); + } } else { - x->sc_selected = 0; sys_vgui(".x%lx.c dtag blankscalar%lx selected\n", glist_getcanvas(owner), x); sys_vgui(".x%lx.c dtag .scalar%lx scalar_selected\n", glist_getcanvas(owner), x->sc_vec); + if (x->sc_selected != glist_getcanvas(owner)) + { + sys_vgui(".x%lx.c dtag blankscalar%lx scalarGOP\n", + glist_getcanvas(owner), x); + sys_vgui(".x%lx.c dtag .scalar%lx scalarGOP\n", + glist_getcanvas(owner), x->sc_vec); + } + x->sc_selected = 0; } //sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", // glist_getcanvas(owner), owner, state); diff --git a/pd/src/pd.tk b/pd/src/pd.tk index 3f5df1d78f94baf748431b78004566094d1e23af..5944eaeecff6f8b5dcf4bb55e52e6d81a8e06bcd 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -8157,18 +8157,26 @@ proc pdtk_canvas_update_sticky_tip {w} { } # move normal selected items and add (dx, dy) to selected scalars' matrices proc pdtk_canvas_displace_withtag {w dx dy} { + #puts stderr "pdtk_canvas_displace_withtag $dx $dy" $w move selected $dx $dy - foreach item [$w find withtag scalar_selected] { + foreach item [$w find withtag {scalar_selected&&!scalarGOP}] { set matrix [lindex [$w itemconfigure $item -matrix] 4] #puts stderr "A:$matrix" set newx [expr {[lindex $matrix 2 0] + $dx}] set newy [expr {[lindex $matrix 2 1] + $dy}] - #set newx [expr {[lindex $matrix 2 0] + ($dx * [expr 1.0-[lindex $matrix 0 0]])}] - #set newy [expr {[lindex $matrix 2 1] + ($dy * [expr 1.0-[lindex $matrix 1 1]])}] set matrix [lreplace $matrix 2 2 [list $newx $newy]] #puts stderr "B:$matrix" $w itemconfigure $item -matrix $matrix } + foreach item [$w find withtag {scalar_selected&&scalarGOP}] { + set matrix [lindex [$w itemconfigure $item -matrix] 4] + #puts stderr "C:$matrix" + set newx [expr {[lindex $matrix 2 0] + ($dx * [expr 1.0-[lindex $matrix 0 0]])}] + set newy [expr {[lindex $matrix 2 1] + ($dy * [expr 1.0-[lindex $matrix 1 1]])}] + set matrix [lreplace $matrix 2 2 [list $newx $newy]] + #puts stderr "D:$matrix" + $w itemconfigure $item -matrix $matrix + } } # move activewidth to toggle on editmode?