diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index fadc9f7e20e6583979c9dd089d6e0de588272b1e..ebb490ce841fdd27ee879c987df2976f6de4ad61 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -1919,7 +1919,6 @@ static void canvas_f(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { gobj_vis(g, xp, 0); gobj_vis(g, xp, 1); - gobj_select(g, xp, 1); } } } diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 1a81ba19ec2ac2519ad58c835eb85b64e1eaf939..2297ad1190b62c07a068f0c40acb38ca375c49dc 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -3179,7 +3179,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { if (doit) { - if (!glist_isselected(x, y)) + if (!glist_isselected(x, y) || x->gl_editor->e_selection->sel_next) { glist_noselect(x); glist_select(x, y); @@ -4542,8 +4542,7 @@ void canvas_mouseup(t_canvas *x, canvas_doconnect(x, xpos, ypos, which, 1); else if (x->gl_editor->e_onmotion == MA_REGION) canvas_doregion(x, xpos, ypos, 1); - else if (x->gl_editor->e_onmotion == MA_MOVE || - x->gl_editor->e_onmotion == MA_RESIZE) + else if (x->gl_editor->e_onmotion == MA_MOVE) { /* after motion or resizing, if there's only one text item selected, activate the text */ @@ -5033,6 +5032,10 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, gobj_vis(y1, x, 0); canvas_fixlinesfor(x, ob); gobj_vis(y1, x, 1); + // object vis function should check if the object is still + // selected, so as to draw the outline in the right color + // it should also tag all aspects with selected tag + // fprintf(stderr,"MA_RESIZE gobj=%lx\n", y1); canvas_dirty(x, 1); } else if (ob && ob->ob_pd == canvas_class) diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index 6b72a1f6150ecabe402773791b7aef16072e8912..c17f7c9715c357c98c40b0744cf844b90d20ba48 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -334,13 +334,13 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, } if (action == SEND_FIRST) { - sys_vgui("pdtk_text_new .x%lx.c {%s %s text} %f %f {%.*s} %d %s\n", + //fprintf(stderr,"send_first rtext=%lx t_text=%lx\n", x, x->x_text); + sys_vgui("pdtk_text_new .x%lx.c {%s %s text %s} %f %f {%.*s} %d %s\n", canvas, x->x_tag, rtext_gettype(x)->s_name, + (glist_isselected(x->x_glist, ((t_gobj*)x->x_text)) ? "selected" : ""), dispx + LMARGIN, dispy + TMARGIN, outchars_b, tempbuf, sys_hostfontsize(font), - (glist_isselected(x->x_glist, - &x->x_glist->gl_gobj)? "$pd_colors(selection)" : - "$pd_colors(text)")); + (glist_isselected(x->x_glist, ((t_gobj*)x->x_text)) ? "$pd_colors(selection)" : "$pd_colors(text)")); } else if (action == SEND_UPDATE) { diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 55bba4a7459be1a834a817f2a98befd4deb54c14..88bc58b9f5eb3f59dd445eabc3fd0d6ddca2cb98 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -1799,6 +1799,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i; int width = x2 - x1; int issignal; + int selected = glist_isselected(glist, (t_gobj*)ob); for (i = 0; i < n; i++) { int onset = x1 + (width - IOWIDTH) * i / nplus; @@ -1807,14 +1808,15 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, //fprintf(stderr,"glist_drawiofor o firsttime\n"); issignal = obj_issignaloutlet(ob,i); sys_vgui(".x%lx.c create prect %d %d %d %d \ - -fill %s -stroke %s -tags {%so%d %lx outlet %s}\n", + -fill %s -stroke %s -tags {%so%d %lx outlet %s %s}\n", glist_getcanvas(glist), onset, y2 - 2, onset + IOWIDTH, y2, (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)"), (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"), tag, i, tag, - (issignal ? "signal" : "control")); + (issignal ? "signal" : "control"), + (selected ? "selected" : "")); } else { //fprintf(stderr,"glist_drawiofor o redraw\n"); @@ -1840,7 +1842,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, //fprintf(stderr,"glist_drawiofor i firsttime\n"); issignal = obj_issignalinlet(ob,i); sys_vgui(".x%lx.c create prect %d %d %d %d \ - -fill %s -stroke %s -tags {%si%d %lx inlet %s}\n", + -fill %s -stroke %s -tags {%si%d %lx inlet %s %s}\n", glist_getcanvas(glist), onset, y1, onset + IOWIDTH, y1 + EXTRAPIX, (issignal ? "$pd_colors(signal_nlet)" : @@ -1848,7 +1850,8 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"), tag, i, tag, - (issignal ? "signal" : "control")); + (issignal ? "signal" : "control"), + (selected ? "selected" : "")); } else { //fprintf(stderr,"glist_drawiofor i firsttime\n"); @@ -1945,6 +1948,8 @@ void text_drawborder(t_text *x, t_glist *glist, t_object *ob; int x1, y1, x2, y2; + int selected = glist_isselected(glist, (t_gobj*)x); + /* if this is gop patcher, the getrect should be equal to gop-ed window rather than just the size of text */ if (pd_class(&x->te_pd) == canvas_class && @@ -1987,10 +1992,12 @@ void text_drawborder(t_text *x, t_glist *glist, if (firsttime) { sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d \ - -stroke %s -fill %s -tags {%sR %lx text %s}\n", - glist_getcanvas(glist), - x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, - outline, fill, tag, tag, box_tag); + -stroke %s -fill %s -tags {%sR %lx text %s %s}\n", + glist_getcanvas(glist), + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, + (selected ? "$pd_colors(selection)" : outline), + fill, tag, tag, box_tag, + (selected ? "selected" : "")); //-dash %s -> pattern disabled for tkpath } else @@ -2010,12 +2017,13 @@ void text_drawborder(t_text *x, t_glist *glist, if (firsttime) sys_vgui(".x%lx.c create ppolygon " "%d %d %d %d %d %d %d %d %d %d %d %d %d %d " - "-stroke $pd_colors(msg_border) -fill $pd_colors(msg) " - "-tags {%sR %lx text msg box}\n", + "-stroke %s -fill $pd_colors(msg) " + "-tags {%sR %lx text msg box %s}\n", glist_getcanvas(glist), x1, y1, x2+4, y1, x2, y1+4, x2, y2-4, x2+4, y2, x1, y2, x1, y1, - tag, tag); + (selected ? "$pd_colors(selection)" : "$pd_colors(msg_border)"), + tag, tag, (selected ? "selected" : "")); else sys_vgui(".x%lx.c coords %sR " "%d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", @@ -2028,12 +2036,13 @@ void text_drawborder(t_text *x, t_glist *glist, if (firsttime) sys_vgui(".x%lx.c create ppolygon " "%d %d %d %d %d %d %d %d %d %d %d %d " - "-stroke $pd_colors(atom_box_border) " + "-stroke %s " "-fill $pd_colors(atom_box) " - "-tags {%sR %lx text atom box}\n", + "-tags {%sR %lx text atom box %s}\n", glist_getcanvas(glist), x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1, - tag, tag); + (selected ? "$pd_colors(selection)" : "$pd_colors(atom_box_border)"), + tag, tag, (selected ? "selected" : "")); else sys_vgui(".x%lx.c coords %sR " "%d %d %d %d %d %d %d %d %d %d %d %d\n", @@ -2047,18 +2056,20 @@ void text_drawborder(t_text *x, t_glist *glist, on top level--this avoids bugggy behavior where comment rectangles are drawn inside a GOP on another toplevel glist when the GOP subpatch is in edit mode */ - else if (x->te_type == T_TEXT && glist->gl_edit && glist_istoplevel(glist)) + else if (x->te_type == T_TEXT && glist->gl_edit && glist_istoplevel(glist)) { if (firsttime) { /*sys_vgui(".x%lx.c create pline\ %d %d %d %d -tags [list %sR commentbar] -stroke $pd_colors(atom_box_border)\n",*/ sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d\ - -tags [list %sR commentbar] -stroke $pd_colors(box_border)\ + -tags [list %sR commentbar %s] -stroke %s\ -strokewidth 1 -strokedasharray {2 2} -strokelinecap butt\n", glist_getcanvas(glist), //x2, y1, x2, y2, tag); - x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, tag); + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, tag, + (selected ? "selected" : ""), + (selected ? "$pd_colors(selection)" : "$pd_colors(box_border)")); } else {