diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index c303be6019068d220834664e496054cfb77684be..417a1444b3c76b22687d7da194573d89f5df5644 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -630,6 +630,22 @@ int iem_fstyletoint(t_iemgui *x) return ((x->x_font_style << 0) & 63); } +char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj) +{ + t_gobj *y = (t_gobj *)iem_obj; + t_object *ob = pd_checkobject(&y->g_pd); + + /* GOP objects are unable to call findrtext + triggering consistency check error */ + t_rtext *yyyy = NULL; + if (!glist->gl_isgraph || glist_istoplevel(glist)) + yyyy = glist_findrtext(glist_getcanvas(glist), (t_text *)&ob->ob_g); + + /* on GOP we cause segfault as text_gettag() returns bogus data */ + if (yyyy) return(rtext_gettag(yyyy)); + else return("bogus"); +} + //---------------------------------------------------------------- // SCALEHANDLE COMMON CODE (by Mathieu, refactored from existing code) @@ -997,11 +1013,12 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags) if(a && !b) for (i=0; i<n; i++) sys_vgui(".x%lx.c create prect %d %d %d %d " "-stroke $pd_colors(iemgui_nlet) " - "-tags {x%lxo%d x%lx outlet %s}\n", + "-tags {%so%d x%lx outlet %s}\n", canvas, x1+i*k, y2-1, x1+i*k + IOWIDTH, y2, - x, i, x, x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); + iem_get_tag(canvas, x), i, x, + x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); if(!a && b) for (i=0; i<n; i++) - sys_vgui(".x%lx.c delete x%lxo%d\n", canvas, x, i); + sys_vgui(".x%lx.c delete %so%d\n", canvas, iem_get_tag(canvas, x), i); a=old_sr_flags&IEM_GUI_OLD_RCV_FLAG; b=x->x_rcv!=s_empty; @@ -1009,11 +1026,12 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags) if(a && !b) for (i=0; i<n; i++) sys_vgui(".x%lx.c create prect %d %d %d %d " "-stroke $pd_colors(iemgui_nlet) " - "-tags {x%lxi%d x%lx inlet %s}\n", + "-tags {%si%d x%lx inlet %s}\n", canvas, x1+i*k, y1, x1+i*k + IOWIDTH, y1+1, - x, i, x, x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); + iem_get_tag(canvas, x), i, x, + x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); if(!a && b) for (i=0; i<n; i++) - sys_vgui(".x%lx.c delete x%lxi%d\n", canvas, x, i); + sys_vgui(".x%lx.c delete %si%d\n", canvas, iem_get_tag(canvas, x), i); } void iemgui_io_draw_move(t_iemgui *x) { @@ -1023,11 +1041,11 @@ void iemgui_io_draw_move(t_iemgui *x) { c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2); int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH; if(!iemgui_has_snd(x) && canvas == x->x_glist) for (i=0; i<n; i++) - sys_vgui(".x%lx.c coords x%lxo%d %d %d %d %d\n", - canvas, x, i, x1+i*k, y2-1, x1+i*k+IOWIDTH, y2); + sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n", + canvas, iem_get_tag(canvas, x), i, x1+i*k, y2-1, x1+i*k+IOWIDTH, y2); if(!iemgui_has_rcv(x) && canvas == x->x_glist) for (i=0; i<n; i++) - sys_vgui(".x%lx.c coords x%lxi%d %d %d %d %d\n", - canvas, x, i, x1+i*k, y1, x1+i*k+IOWIDTH, y1+1); + sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n", + canvas, iem_get_tag(canvas, x), i, x1+i*k, y1, x1+i*k+IOWIDTH, y1+1); } void iemgui_base_draw_new(t_iemgui *x) { diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 759a69018d9b42877f66fa7fbdf0062ec92a8034..e744630bfbdfd2a8cbdcf2f76a70e7adf9c18ef4 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -123,19 +123,23 @@ int gobj_filter_highlight_behavior(t_text *y) void canvas_raise_all_cords (t_canvas *x) { sys_vgui(".x%lx.c raise all_cords\n", x); } + static void canvas_enteritem (t_canvas *x, int xpos, int ypos, const char *tag) { sys_vgui("pdtk_canvas_enteritem .x%x.c %d %d %s -1\n", x, xpos, ypos, tag); } + static void canvas_leaveitem (t_canvas *x) { sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x); } + static void tooltip_erase (t_canvas *x) { if (objtooltip) { objtooltip = 0; canvas_leaveitem(x); } } + static void canvas_nlet_conf (t_canvas *x, int type) { int filter = type=='o' ? last_outlet_filter : last_inlet_filter; int issignal = type=='o' ? outlet_issignal : inlet_issignal; @@ -145,14 +149,16 @@ static void canvas_nlet_conf (t_canvas *x, int type) { (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)")), (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)")); } -static void canvas_nlet_conf2 (t_canvas *x, int cond) { // because of one exception... + +/*static void canvas_nlet_conf2 (t_canvas *x, int cond) { // because of one exception... int issignal = inlet_issignal; sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_inlet_tag, (last_inlet_filter ? "$pd_colors(iemgui_nlet)" : (cond ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)")), (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)")); -} +}*/ + void canvas_getscroll (t_canvas *x) { sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",(long)x); } @@ -3786,8 +3792,9 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2, // if the first object is preset_node, check if the object // we are connecting to is supported. If not, disallow connection + // but only do so from the first outlet - if (pd_class(&y1->g_pd) == preset_node_class) + if (pd_class(&y1->g_pd) == preset_node_class && closest1 == 0) { if (pd_class(&y2->g_pd) == message_class) { @@ -3837,7 +3844,7 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2, oc);*/ if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - canvas_nlet_conf2(x,obj_issignalinlet(ob2, closest2)); + canvas_nlet_conf(x,'i'); tooltip_erase(x); x->gl_editor->canvas_cnct_inlet_tag[0] = 0; } @@ -5111,6 +5118,7 @@ void canvas_startmotion(t_canvas *x) if (!x->gl_editor) return; glist_getnextxy(x, &xval, &yval); //if (xval == 0 && yval == 0) return; + canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); x->gl_editor->e_onmotion = MA_MOVE; x->gl_editor->e_xwas = xval; x->gl_editor->e_ywas = yval; @@ -6313,8 +6321,9 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, goto bad; } /* now check for illegal connections between preset_node object - and other non-supported objects */ - if (pd_class(&src->g_pd) == preset_node_class) + and other non-supported objects from node's first outlet + (node's second outlet is for status info) */ + if (pd_class(&src->g_pd) == preset_node_class && outno == 0) { if (pd_class(&sink->g_pd) == message_class) { diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 03830c6ff9af08aa75f171e6c0bd9cf4f91ac78b..4eab6668019b17e49c09833acd0699f4575359f9 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -102,7 +102,7 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv) (void *)canvas_undo_set_create(glist_getcanvas(gl))); if (connectme == 0) { - canvas_displaceselection(glist_getcanvas(gl), -10, -10); + canvas_displaceselection(glist_getcanvas(gl), -7, -7); canvas_startmotion(glist_getcanvas(gl)); } } @@ -346,7 +346,7 @@ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv) else if (connectme == 0) { //fprintf(stderr,"canvas_obj calls canvas_startmotion\n"); - canvas_displaceselection(glist_getcanvas(gl), -10, -10); + canvas_displaceselection(glist_getcanvas(gl), -7, -7); canvas_startmotion(glist_getcanvas(gl)); } //canvas_setundo(glist_getcanvas(gl), @@ -446,7 +446,7 @@ void canvas_iemguis(t_glist *gl, t_symbol *guiobjname) //canvas_objtext(gl, xpix, ypix, 1, b); else if (connectme == 0) { - canvas_displaceselection(glist_getcanvas(gl), -10, -10); + canvas_displaceselection(glist_getcanvas(gl), -7, -7); canvas_startmotion(glist_getcanvas(gl)); } //canvas_setundo(glist_getcanvas(gl), @@ -769,7 +769,7 @@ void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) canvas_connect(gl, indx, 0, nobj, 0); else if (connectme == 0) { - canvas_displaceselection(glist_getcanvas(gl), -10, -10); + canvas_displaceselection(glist_getcanvas(gl), -7, -7); canvas_startmotion(glist_getcanvas(gl)); } //canvas_setundo(glist_getcanvas(gl), @@ -1268,7 +1268,7 @@ void canvas_atom(t_glist *gl, t_atomtype type, canvas_connect(gl, indx, 0, nobj, 0); else if (connectme == 0) { - canvas_displaceselection(glist_getcanvas(gl), -10, -10); + canvas_displaceselection(glist_getcanvas(gl), -7, -7); canvas_startmotion(glist_getcanvas(gl)); } //canvas_setundo(glist_getcanvas(gl), diff --git a/pd/src/pd-l2ork-TODO.txt b/pd/src/pd-l2ork-TODO.txt index ac5d06e8f6d5ee616b589e61d0e941941c4f7ec2..1903d902fc2c162e35ec35d8acf5def67c521ef2 100644 --- a/pd/src/pd-l2ork-TODO.txt +++ b/pd/src/pd-l2ork-TODO.txt @@ -1,6 +1,7 @@ C: -*messages should be aware of $0? +*what is the ideal offset for startmotion to avoid handles in iemguis? +*messages should be aware of $0? *verbosity level for the console *Draw SECONDARY redrect on gop scalar patchers to reflect the viewport?