From 3f69774d30ad384e2ab80a42a2f7163e49b25f9c Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Mon, 9 Jun 2014 01:49:08 -0400 Subject: [PATCH] *added recursive checking for when objects are selected to properly reselect arrays nested inside GOP subpatches/abstractions. This is important because the implementation should work for any level of depth. Later consider making this a more universal check should such prove necessary (I think once we move away from redrawing the array every time a point is moved, all this will become moot) --- pd/src/g_array.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 6bce64f2a..c21c869b6 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -1252,6 +1252,7 @@ static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy) static void garray_select(t_gobj *z, t_glist *glist, int state) { + //fprintf(stderr,">>>>>>>>>>>>garray_select %d\n", state); t_garray *x = (t_garray *)z; sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", glist_getcanvas(glist), x->x_glist, state); @@ -1373,18 +1374,32 @@ 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,"garray_doredraw isselected\n"); - sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", - glist_getcanvas(glist), 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); + } + //fprintf(stderr,"check if we need to reselect %lx %lx %lx\n", + // glist_getcanvas(glist), (t_gobj *)glist, glist->gl_owner); + int selected = 0; + t_glist *sel = glist->gl_owner; + while (sel && sel != glist_getcanvas(glist)) + { + if (glist_isselected(glist_getcanvas(glist), (t_gobj *)sel)) + { + selected = 1; + break; + } + sel = sel->gl_owner; + } + if (selected) + { + //fprintf(stderr,"garray_doredraw isselected\n"); + sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", + glist_getcanvas(glist), glist, 1); + } } } -- GitLab