diff --git a/pd/src/g_array.c b/pd/src/g_array.c index e2df01c985047b38194ded077feff63e4ab5d98f..2706f685eb78e7ccce0e943e43510081b44e3414 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -93,10 +93,10 @@ void array_resize_and_redraw(t_array *array, t_glist *glist, int n) while (a2->a_gp.gp_stub->gs_which == GP_ARRAY) a2 = a2->a_gp.gp_stub->gs_un.gs_array; if (vis) - gobj_vis(&a2->a_gp.gp_un.gp_gobj, glist, 0); + gobj_vis(a2->a_gp.gp_un.gp_gobj, glist, 0); array_resize(array, n); if (vis) - gobj_vis(&a2->a_gp.gp_un.gp_gobj, glist, 1); + gobj_vis(a2->a_gp.gp_un.gp_gobj, glist, 1); } void word_free(t_word *wp, t_template *template); @@ -870,11 +870,11 @@ void array_getcoordinate(t_glist *glist, // so that the smallest hitbox is always at least 8x8 // check with all_about_arrays.pd inside custom scalars // in an array - if (*xp1 == *xp2) + if (glist_topixels && *xp1 == *xp2) { *xp1 = *xp1 - 4; *xp2 = *xp2 + 4; - wpix = 8; + if (wpix < 8) wpix = 8; } *wp = wpix; } @@ -1077,7 +1077,8 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_float best = -1; /* if it has more than 2000 points, just check 1000 of them. */ int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); - t_float pxpix1, pxpix2, pypix, pwpix, dx, dy, dy2, dy3; + t_float pxpix1 = 0.0, pxpix2 = 0.0, pypix = 0.0, pwpix = 0.0, + dx, dy, dy2, dy3; for (i = 0; i < array->a_n; i += incr) { array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, @@ -1166,6 +1167,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, /* from array-rev */ +#if 0 // this doesn't seem to be used anywhere -ag int hit = 0; if(array_joc) { @@ -1173,6 +1175,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, } else hit = dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best; +#endif /* end array-rev */ if (dy < dy2 && dy < dy3) @@ -1311,6 +1314,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, return (0); } +#if 0 // this doesn't seem to be used anywhere -ag static void array_getrect(t_array *array, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { @@ -1354,6 +1358,7 @@ static void array_getrect(t_array *array, t_glist *glist, *xp2 = x2; *yp2 = y2; } +#endif /* -------------------- widget behavior for garray ------------ */ @@ -1379,6 +1384,7 @@ static void garray_select(t_gobj *z, t_glist *glist, int state) //sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", // glist_getcanvas(glist), x->x_glist, state); + extern void scalar_select(t_gobj *z, t_glist *owner, int state); scalar_select((t_gobj *)x->x_scalar, glist, state); } diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index 8992e38cc17fe0eca119bc622888d7c28c4d21c4..38463cd52709b9ce0d476255e2280b1bf2a54636 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -547,17 +547,29 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) x1--; x2++; y1--; y2++; if (glist_istoplevel(glist)) { - t_float xscale = glist_xtopixels(glist, 1) - - glist_xtopixels(glist, 0); - t_float yscale = glist_ytopixels(glist, 1) - - glist_ytopixels(glist, 0); - gui_vmess("gui_scalar_draw_select_rect", "xsiiiiiff", + t_float xorig = glist_xtopixels(glist, 0); + t_float yorig = glist_ytopixels(glist, 0); + t_float xscale = glist_xtopixels(glist, 1) - xorig; + t_float yscale = glist_ytopixels(glist, 1) - yorig; + // unscaled x/y coordinates + t_float u1 = (x1 - xorig) / xscale; + t_float v1 = (y1 - yorig) / yscale; + t_float u2 = (x2 - xorig) / xscale; + t_float v2 = (y2 - yorig) / yscale; + // make sure that these are in the right order, + // gui_scalar_draw_select_rect expects them that way + if (u2 < u1) { + t_float u = u2; + u2 = u1; u1 = u; + } + if (v2 < v1) { + t_float v = v2; + v2 = v1; v1 = v; + } + gui_vmess("gui_scalar_draw_select_rect", "xsiffffff", glist_getcanvas(glist), tagbuf, state, - (int)(x1 / xscale), - (int)(y1 / yscale), - (int)(x2 / xscale), - (int)(y2 / yscale), + u1, v1, u2, v2, basex, basey); } diff --git a/pd/src/g_template.c b/pd/src/g_template.c index 7e52fa24fd72454c165fd4f22165cf22916f7c14..6a7defc09724d110a27b6722fe4486636cdceb33 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -5483,7 +5483,7 @@ static void plot_getrect(t_gobj *z, t_glist *glist, if (x->x_canvas->gl_owner && x->x_canvas->gl_svg) svg_dogroupmtx(x->x_canvas, template, data, mtx1); //post("plot_getrect matrix: %g %g %g %g %g %g", - // mtx1[0][0], mtx1[1][0], mtx1[0][1], mtx1[1][1], mtx1[0][2], mtx1[2][1]); + // mtx1[0][0], mtx1[1][0], mtx1[0][1], mtx1[1][1], mtx1[0][2], mtx1[1][2]); int elemsize, yonset, wonset, xonset; t_canvas *elemtemplatecanvas; t_template *elemtemplate;