diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 3a6864ee9fb4880da9543356456f981947206d20..6a5aff148109dd07e463b4657699ebc4f29ef7ba 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -469,15 +469,12 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, pd_unbind(&x->x_gobj.g_pd, x->x_realname); x->x_realname = canvas_realizedollar(x->x_glist, argname); pd_bind(&x->x_gobj.g_pd, x->x_realname); - /* redraw the whole glist, just so the name change shows up */ - if (x->x_glist->gl_havewindow) - canvas_redraw(x->x_glist); - else if (glist_isvisible(x->x_glist->gl_owner)) - { - gobj_vis(&x->x_glist->gl_gobj, x->x_glist->gl_owner, 0); - gobj_vis(&x->x_glist->gl_gobj, x->x_glist->gl_owner, 1); - } } + /* redraw the whole glist, just so the name change shows up */ + if (x->x_glist->gl_havewindow) { + canvas_redraw(glist_getcanvas(x->x_glist)); + //fprintf(stderr,"================REDRAW\n"); + } size = fsize; if (size < 1) size = 1; @@ -487,7 +484,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, x->x_style = style; garray_fittograph(x, size); } - fprintf(stderr,"style=%d %f\n", style, (t_float)x->x_style); + //fprintf(stderr,"style=%d %f\n", style, (t_float)x->x_style); template_setfloat(scalartemplate, gensym("style"), x->x_scalar->sc_vec, (t_float)x->x_style, 0); template_setfloat(scalartemplate, gensym("linewidth"), @@ -499,6 +496,33 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, garray_setsaveit(x, (saveit != 0)); garray_redraw(x); + if (glist_getcanvas(x->x_glist) != x->x_glist) + { + int arrange = 0; + t_gobj *y = glist_getcanvas(x->x_glist)->gl_list; + if (y != (t_gobj *)x->x_glist) { + while (y && y->g_next != (t_gobj *)x->x_glist) { + //fprintf(stderr,"================SEARCHING %s\n", rtext_gettag(glist_findrtext(glist_getcanvas(x->x_glist), pd_checkobject(&y->g_pd)))); + y = y->g_next; + } + arrange = 1; + } + //fprintf(stderr,"================FOUND %s %d\n", rtext_gettag(glist_findrtext(glist_getcanvas(x->x_glist), pd_checkobject(&y->g_pd))), arrange); + char *below = rtext_gettag(glist_findrtext(glist_getcanvas(x->x_glist), pd_checkobject(&y->g_pd))); + glist_noselect(glist_getcanvas(x->x_glist)); + gobj_vis(&x->x_glist->gl_gobj, glist_getcanvas(x->x_glist), 0); + gobj_vis(&x->x_glist->gl_gobj, glist_getcanvas(x->x_glist), 1); + glist_select(glist_getcanvas(x->x_glist), (t_gobj *)x->x_glist); + + if (!arrange) { + sys_vgui(".x%lx.c lower selected\n", glist_getcanvas(x->x_glist)); + //fprintf(stderr,"--------------TOBOTTOM\n"); + } else { + sys_vgui(".x%lx.c lower selected %s\n", glist_getcanvas(x->x_glist), below); + sys_vgui(".x%lx.c raise selected %s\n", glist_getcanvas(x->x_glist), below); + //fprintf(stderr,"++++++++++++++TOMIDDLE\n"); + } + } canvas_dirty(x->x_glist, 1); } } @@ -1136,8 +1160,8 @@ static void garray_save(t_gobj *z, t_binbuf *b) } /* style = template_getfloat(scalartemplate, gensym("style"), x->x_scalar->sc_vec, 0); */ - filestyle = (x->x_style == PLOTSTYLE_POINTS ? 1 : - (x->x_style == PLOTSTYLE_POLY ? 0 : x->x_style)); + filestyle = (x->x_style == PLOTSTYLE_POINTS ? 0 : + (x->x_style == PLOTSTYLE_POLY ? 1 : x->x_style)); binbuf_addv(b, "sssisi;", gensym("#X"), gensym("array"), x->x_name, array->a_n, &s_float, x->x_saveit + 2 * filestyle + 8*x->x_hidename); diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index 46603e84bdd14edcdfb7615eac6948c8c3caf9da..fdcb524e96d4316ee360d89e59bf831ca5acb34c 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -72,13 +72,15 @@ void bng_draw_new(t_bng *x, t_glist *glist) else nlet_tag = "bogus"; - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxBNG %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxBNG %lx text}\n", canvas, xpos, ypos, xpos + x->x_gui.x_w, ypos + x->x_gui.x_h, x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create oval %d %d %d %d -fill #%6.6x -tags {%lxBUT %lxBNG %lx text}\n", - canvas, xpos+1, ypos+1, - xpos + x->x_gui.x_w-1, ypos + x->x_gui.x_h-1, + int cr = (x->x_gui.x_w-(x->x_gui.x_w % 2 ? 0 : 1))/2; + int cx = xpos+1+cr; + int cy = ypos+1+cr; + sys_vgui(".x%lx.c create circle %d %d -r %d -fill #%6.6x -tags {%lxBUT %lxBNG %lx text}\n", + canvas, cx, cy, cr, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxBNG %lx text}\n", @@ -88,13 +90,13 @@ void bng_draw_new(t_bng *x, t_glist *glist) x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos + IOWIDTH, ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); } if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG %lx inlet}\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); } @@ -125,11 +127,15 @@ void bng_draw_move(t_bng *x, t_glist *glist) sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, xpos, ypos, xpos + x->x_gui.x_w, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxBUT %d %d %d %d\n", - canvas, x, xpos+1,ypos+1, - xpos + x->x_gui.x_w-1, ypos + x->x_gui.x_h-1); - sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n", canvas, x, - x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); + int cr = (x->x_gui.x_w-(x->x_gui.x_w % 2 ? 0 : 1))/2; + int cx = xpos+1+cr; + int cy = ypos+1+cr; + /*sys_vgui(".x%lx.c create circle %d %d -r %d -stroke #%6.6x -tags {%lxBUT %lxBNG %lx text}\n", + canvas, cx, cy, cr,*/ + sys_vgui(".x%lx.c coords %lxBUT %d %d\n", + canvas, x, cx, cy); + sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x -r %d\n", canvas, x, + x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, cr); sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) @@ -221,14 +227,14 @@ void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos + IOWIDTH, ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxBNG%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG %lx inlet}\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) @@ -250,8 +256,8 @@ void bng_draw_select(t_bng* x, t_glist* glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); - sys_vgui(".x%lx.c itemconfigure %lxBUT -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBUT -stroke $select_color\n", canvas, x); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); if (x->x_gui.scale_vis) { @@ -302,8 +308,8 @@ void bng_draw_select(t_bng* x, t_glist* glist) } else { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%lx.c itemconfigure %lxBUT -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); sys_vgui(".x%lx.c dtag %lxBNG selected\n", canvas, x); sys_vgui("destroy %s\n", sh->h_pathname); @@ -378,8 +384,8 @@ static void bng__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_fl if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_gui.x_w, x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag); diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index 505190331e1166e5faada23eea6a8d8b01650214..50d16a9e2a6493fd7d74ae92a931d3ac4d5cba65 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -16,6 +16,8 @@ to be different but are now unified except for some fossilized names.) */ #include <string.h> extern int do_not_redraw; +extern void canvas_drawconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag, int issignal); +extern void canvas_updateconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag); /* LATER consider adding font size to this struct (see glist_getfont()) */ struct _canvasenvironment @@ -811,7 +813,8 @@ void canvas_map(t_canvas *x, t_floatarg f) { /* just clear out the whole canvas */ sys_vgui(".x%lx.c dtag all selected\n", x); - sys_vgui(".x%lx.c delete all\n", x); + //sys_vgui(".x%lx.c delete all\n", x); + sys_vgui("foreach item [.x%lx.c find withtag {(!root)}] { .x%lx.c delete $item }\n", x, x); x->gl_mapped = 0; } } @@ -934,11 +937,12 @@ static void canvas_drawlines(t_canvas *x) { issignal = (outlet_getsymbol(t.tr_outlet) == &s_signal ? 1 : 0); if (!(pd_class(&t.tr_ob2->ob_g.g_pd) == preset_node_class && pd_class(&t.tr_ob->ob_g.g_pd) != message_class)) - sys_vgui(".x%lx.c create line %d %d %d %d -width %s -fill %s \ + canvas_drawconnection(glist_getcanvas(x), t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, (t_int)oc, issignal); + /*sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %s -stroke %s \ -tags {l%lx all_cords}\n", glist_getcanvas(x), t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, (issignal ? "$signal_cord_width" : "$msg_cord_width"), (issignal ? "$signal_cord" : "$msg_cord"), - oc); + oc);*/ } } @@ -952,9 +956,10 @@ void canvas_fixlinesfor(t_canvas *x, t_text *text) { if (t.tr_ob == text || t.tr_ob2 == text) { - sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n", + /*sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n", glist_getcanvas(x), oc, - t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2); + t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);*/ + canvas_updateconnection(x, t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, (t_int)oc); } } } diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 3859b5beb4afcd42b9b1ae5a9efebcd3bcbaf068..a106d7ec009f491078d68f620843875b939cd351 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -1,6 +1,10 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. +/* Copyright (c) 2009-2013 Ivica Ico Bukvic and others. Code based on Pure-Data source + +Original Pure-Data source copyright (c) 1997-2001 Miller Puckette and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +*/ #include <stdlib.h> #include <stdio.h> @@ -39,7 +43,7 @@ static void canvas_reselect(t_canvas *x); static void canvas_cut(t_canvas *x); static void canvas_undo(t_canvas *x); static int paste_xyoffset = 0; /* a counter of pastes to make x,y offsets */ -static void canvas_mouseup_gop(t_canvas *x, t_gobj *g); +//static void canvas_mouseup_gop(t_canvas *x, t_gobj *g); static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float ypos); static void canvas_doarrange(t_canvas *x, t_float which, t_gobj *oldy, t_gobj *oldy_prev, t_gobj *oldy_next); static void canvas_paste_xyoffset(t_canvas *x); @@ -239,11 +243,85 @@ int gobj_click(t_gobj *x, struct _glist *glist, /* ------------------------ managing the selection ----------------- */ +// direction -1 = lower, 1 = raise +int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag, int dir) +{ + // we do this instead to save us costly redraw of the canvas + t_object *ob = NULL; + t_rtext *yrnxt = NULL, *yr = NULL; + int ret = 0; + + if (!glist_isselected(x, y) && objtag) + sys_vgui(".x%lx.c addtag selected withtag %s\n", x, objtag); + if (y->g_next) { + ob = pd_checkobject(&y->g_next->g_pd); + } else { + ret = 1; + } + if (ob) { + yrnxt = glist_findrtext(x, (t_text *)&ob->ob_g); + } + if (y) { + ob = pd_checkobject(&y->g_pd); + } else { + ret = 1; + } + if (ob) { + yr = glist_findrtext(x, (t_text *)&ob->ob_g); + } + if (ret != 1) { + if (dir == -1) { + if (yrnxt) { + //fprintf(stderr,"lower\n"); + //if (!sel) + // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 1\n", x, rtext_gettag(yr)); + sys_vgui("pdtk_find_lowest_widget_withtag .x%lx.c %s\n", x, rtext_gettag(yrnxt)); + sys_vgui(".x%lx.c lower selected $::arrange_lowest\n", x); + //if (!sel) + // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 0\n", x, rtext_gettag(yr)); + } else if (x->gl_list == y) { + // we get here if we are supposed to go all the way to the bottom + //fprintf(stderr,"lower to the bottom\n"); + sys_vgui(".x%lx.c lower selected\n", x); + } else { + // fall back to legacy redraw for objects that are not patchable + //fprintf(stderr,"lower fallback redraw\n"); + canvas_redraw(x); + ret = -1; + } + } else { + if (yrnxt) { + //fprintf(stderr,"raise\n"); + //if (!sel) + // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 1\n", x, rtext_gettag(yr)); + sys_vgui(".x%lx.c raise selected\n", x); + sys_vgui("pdtk_find_lowest_widget_withtag .x%lx.c %s\n", x, rtext_gettag(yrnxt)); + sys_vgui(".x%lx.c lower selected $::arrange_lowest\n", x); + //if (!sel) + // sys_vgui("pdtk_select_all_gop_widgets .x%lx %s 0\n", x, rtext_gettag(yr)); + } else if (y->g_next == NULL) { + // we get here if we are supposed to go all the way to the top + //fprintf(stderr,"raise to the top\n"); + sys_vgui(".x%lx.c raise selected\n", x); + sys_vgui(".x%lx.c raise all_cords\n", x); + } else { + // fall back to legacy redraw for objects that are not patchable + //fprintf(stderr,"raise fallback redraw\n"); + canvas_redraw(x); + ret = -1; + } + } + } + if (!glist_isselected(x, y) && objtag) + sys_vgui(".x%lx.c dtag %s selected\n", x, objtag); + return(ret); +} + void canvas_check_nlet_highlights(t_glist *x) { if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -260,7 +338,7 @@ void canvas_check_nlet_highlights(t_glist *x) if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0 && x->gl_editor->e_onmotion != MA_CONNECT) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -288,7 +366,7 @@ void glist_selectline(t_glist *x, t_outconnect *oc, int index1, x->gl_editor->e_selectline_index2 = index2; x->gl_editor->e_selectline_inno = inno; x->gl_editor->e_selectline_tag = oc; - sys_vgui(".x%lx.c itemconfigure l%lx -fill $select_color\n", + sys_vgui(".x%lx.c itemconfigure l%lx -stroke $select_color\n", x, x->gl_editor->e_selectline_tag); sys_vgui(".x%lx.c addtag selected withtag l%lx\n", glist_getcanvas(x), x->gl_editor->e_selectline_tag); @@ -313,7 +391,7 @@ void glist_deselectline(t_glist *x) issignal = 1; else issignal = 0; - sys_vgui(".x%lx.c itemconfigure l%lx -fill %s\n", + sys_vgui(".x%lx.c itemconfigure l%lx -stroke %s\n", x, x->gl_editor->e_selectline_tag, (issignal ? "$signal_cord" : "$msg_cord")); sys_vgui(".x%lx.c dtag l%lx selected\n", @@ -1394,7 +1472,7 @@ void canvas_undo_arrange(t_canvas *x, void *z, int action) prev = glist_nth(x, buf->u_newindex - 1); prev->g_next = NULL; - /* now we reuse vars for the follwoing: + /* now we reuse vars for the following: old index should be right before the object previndex is pointing to as the object was moved to the end */ @@ -1419,29 +1497,8 @@ void canvas_undo_arrange(t_canvas *x, void *z, int action) // and finally redraw canvas //canvas_redraw(x); - // some day when the object tagging is properly done for all GUI objects - t_object *ob = NULL; - t_rtext *yr = NULL; - if (prev) { - ob = pd_checkobject(&prev->g_pd); - } - if (ob) { - yr = glist_findrtext(x, (t_text *)&ob->ob_g); - } - if (yr) { - //fprintf(stderr,"lower\n"); - sys_vgui(".x%lx.c lower selected %s\n", x, rtext_gettag(yr)); - sys_vgui(".x%lx.c raise selected %s\n", x, rtext_gettag(yr)); - //sys_vgui(".x%lx.c raise all_cords\n", x); - } else if (prev == NULL) { - // we get here if we are supposed to go all the way to the bottom - //fprintf(stderr,"lower to the bottom\n"); - sys_vgui(".x%lx.c lower selected\n", x); - } else { - // fall back to legacy redraw for objects that are not patchable - //fprintf(stderr,"lower fallback redraw\n"); - canvas_redraw(x); - }//*/ + // we do this instead to save us costly redraw of the canvas + canvas_restore_original_position(x, y, 0, -1); glob_preset_node_list_check_loc_and_update(); } @@ -1464,29 +1521,8 @@ void canvas_undo_arrange(t_canvas *x, void *z, int action) // and finally redraw canvas //canvas_redraw(x); - // some day when the object tagging is properly done for all GUI objects - t_object *ob = NULL; - t_rtext *yr = NULL; - if (prev) { - ob = pd_checkobject(&prev->g_pd); - } - if (ob) { - yr = glist_findrtext(x, (t_text *)&ob->ob_g); - } - if (yr) { - //fprintf(stderr,"raise\n"); - sys_vgui(".x%lx.c raise selected %s\n", x, rtext_gettag(yr)); - //sys_vgui(".x%lx.c raise all_cords\n", x); - } else if (next == NULL) { - // we get here if we are supposed to go all the way to the top - //fprintf(stderr,"raise to the top\n"); - sys_vgui(".x%lx.c raise selected\n", x); - } else { - // fall back to legacy redraw for objects that are not patchable - //fprintf(stderr,"raise fallback redraw\n"); - canvas_redraw(x); - }//*/ - + // we do this instead to save us costly redraw of the canvas + canvas_restore_original_position(x, y, 0, 1); glob_preset_node_list_check_loc_and_update(); } } @@ -1976,7 +2012,8 @@ static char *cursorlist[] = { "$cursor_editmode_connect", "$cursor_editmode_disconnect", "$cursor_editmode_resize", - "$cursor_editmode_resize_bottom_right" + "$cursor_editmode_resize_bottom_right", + "$cursor_scroll" }; void canvas_setcursor(t_canvas *x, unsigned int cursornum) @@ -2055,13 +2092,17 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y_sel) if (x->gl_editor->e_selection) { glist_noselect(x); } + t_gobj *yclick = NULL; for (y = x->gl_list; y; y = y->g_next) { - if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) { - if (!glist_isselected(x, y)) - glist_select(x, y); - break; + if (y && canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) { + yclick = y; } } + if (yclick) { + y = yclick; + if (!glist_isselected(x, y)) + glist_select(x, y); + } // if we are in K12 mode and are requesting popup on comments, bail as we don't want users // to get into conventional help files if (sys_k12_mode && y && pd_class(&y->g_pd) == text_class) @@ -2573,25 +2614,31 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float // mark the beginning of the glist for front/back y_begin = x->gl_list; - if (which == 3 || which == 4) { + t_gobj *yclick = NULL; + + ///if (which == 3 || which == 4) { // if no object has been selected for to-front/back action - if (!x->gl_editor->e_selection) { - //fprintf(stderr,"doing hitbox\n"); - for (y = x->gl_list; y; y = y->g_next) { - if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) { - if (!x->gl_edit) - canvas_editmode(x, 1); - if (!glist_isselected(x, y)) - glist_select(x, y); - } - } - // this was a bogus/unsupported call--get me out of here! - if (!x->gl_editor->e_selection) { - post("To front/back action could not be performed because multiple items were selected..."); - return; + if (!x->gl_editor->e_selection) { + //fprintf(stderr,"doing hitbox\n"); + for (y = x->gl_list; y; y = y->g_next) { + if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) { + yclick = y; } } + if (yclick) { + y = yclick; + if (!x->gl_edit) + canvas_editmode(x, 1); + if (!glist_isselected(x, y)) + glist_select(x, y); + } + // this was a bogus/unsupported call--get me out of here! + if (!x->gl_editor->e_selection) { + post("Popup action could not be performed because multiple items were selected..."); + return; + } } + //} for (y = x->gl_list; y; y = y->g_next) { @@ -2615,7 +2662,7 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float oldy_next = y->g_next; } } - if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) + else if (glist_isselected(x, y)) { if (which == 0) /* properties */ { @@ -2624,8 +2671,8 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float else { if (!x->gl_edit) canvas_editmode(x, 1); - if (!glist_isselected(x, y)) - glist_select(x, y); + //if (!glist_isselected(x, y)) + // glist_select(x, y); (*class_getpropertiesfn(pd_class(&y->g_pd)))(y, x); } return; @@ -2715,8 +2762,9 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, t_gobj *y; int shiftmod, runmode, altmod, doublemod = 0, rightclick; int x1=0, y1=0, x2=0, y2=0, clickreturned = 0; + t_gobj *yclick = NULL; - //fprintf(stderr,"canvas_doclick\n"); + //fprintf(stderr,"canvas_doclick %d %d %d %d %d\n", xpos, ypos, which, mod, doit); if (!x->gl_editor) { @@ -2783,28 +2831,28 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, x->gl_editor->e_ywas = ypos; //fprintf(stderr,"mouse %d %d\n", xpos, ypos); - // if we are in runmode and it is not right-click + // if we are in runmode and it is not middle- or right-click if (runmode && !rightclick) { for (y = x->gl_list; y; y = y->g_next) { - // check if the object wants to be clicked - if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2) - && (clickreturned = gobj_click(y, x, xpos, ypos, - shiftmod, ((mod & CTRLMOD) && (!x->gl_edit)) || altmod, - 0, doit))) - break; + // check if the object wants to be clicked (we pick the topmost) + if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) + yclick = y; } + if (yclick) clickreturned = gobj_click(yclick, x, xpos, ypos, + shiftmod, ((mod & CTRLMOD) && (!x->gl_edit)) || altmod, + 0, doit); // if we are not clicking if (!doit) { - if (y) + if (yclick) canvas_setcursor(x, clickreturned); else canvas_setcursor(x, CURSOR_RUNMODE_NOTHING); } return; } - /* if in editmode left click, fall here. */ + /* if in editmode click, fall here. */ if (y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2)) { t_object *ob; @@ -2893,8 +2941,13 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, x->gl_editor->e_xwas = xpos; x->gl_editor->e_ywas = ypos; sys_vgui( - ".x%lx.c create line %d %d %d %d -fill %s -width %s -tags x\n", - x, xpos, ypos, xpos, ypos, + /*".x%lx.c create polyline %d %d %d %d -stroke %s -strokewidth %s -tags x\n", + x, xpos, ypos, xpos, ypos, + (issignal ? "$signal_cord" : "$msg_cord"), + (issignal ? "$signal_cord_width" : "$msg_cord_width"));*/ + // bezier is too slow for the time being + ".x%lx.c create path \"M %d %d Q %d %d %d %d Q %d %d %d %d\" -stroke %s -strokewidth %s -tags x\n", + x, xpos, ypos, xpos, ypos, xpos, ypos, xpos, ypos, xpos, ypos, (issignal ? "$signal_cord" : "$msg_cord"), (issignal ? "$signal_cord_width" : "$msg_cord_width")); } @@ -2905,7 +2958,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -2918,7 +2971,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, "%so%d", rtext_gettag(yr), closest); - sys_vgui(".x%x.c itemconfigure %s -outline $select_nlet_color -width $highlight_width\n", + sys_vgui(".x%x.c itemconfigure %s -stroke $select_nlet_color -strokewidth $highlight_width\n", x, x->gl_editor->canvas_cnct_outlet_tag); @@ -2962,7 +3015,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -2976,7 +3029,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, "%si%d", rtext_gettag(yr), closest); - sys_vgui(".x%x.c itemconfigure %s -width $highlight_width\n", + sys_vgui(".x%x.c itemconfigure %s -strokewidth $highlight_width\n", x, x->gl_editor->canvas_cnct_inlet_tag); @@ -3040,7 +3093,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3053,7 +3106,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3146,7 +3199,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, } if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3158,7 +3211,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, } if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3176,7 +3229,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, } if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3189,7 +3242,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, // jsarlo if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3204,7 +3257,8 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, magicGlass_hide(x->gl_editor->gl_magic_glass); } // end jsarlo - canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); + if (x->gl_editor->e_onmotion != MA_SCROLL) + canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); if (doit) { if (!shiftmod && (x->gl_editor->e_selection || x->gl_editor->e_selectedline)) { @@ -3216,7 +3270,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, //buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); //canvas_undo_add(x, 11, "selection", buf); } - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags x -outline $select_color\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags x -stroke $select_color\n", x, xpos, ypos, xpos, ypos); x->gl_editor->e_xwas = xpos; x->gl_editor->e_ywas = ypos; @@ -3227,6 +3281,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, void canvas_mousedown(t_canvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg which, t_floatarg mod) { + //fprintf(stderr,"canvas_mousedown %d\n", x->gl_editor->e_onmotion); canvas_doclick(x, xpos, ypos, which, mod, 1); } @@ -3300,6 +3355,51 @@ void canvas_sort_selection_according_to_location(t_canvas *x) }*/ } +void canvas_drawconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag, int issignal) { + int halfx = (lx2 - lx1)/2; + int halfy = (ly2 - ly1)/2; + int yoff = abs((halfy+halfy)/2); + if (yoff < 2) yoff = 2; + if (yoff > 20) yoff = 20; + /*sys_vgui(".x%lx.c create polyline %d %d %d %d -stroke %s -strokewidth %s -tags {l%lx all_cords}\n", + x, lx1, ly1, lx2, ly2, + (issignal ? "$signal_cord" : "$msg_cord"), + (issignal ? "$signal_cord_width" : "$msg_cord_width"), + tag);*/ + //bezier curves FTW + sys_vgui(".x%lx.c create path \"M %d %d Q %d %d %d %d Q %d %d %d %d\" -stroke %s -strokewidth %s -tags {l%lx all_cords}\n", + x, lx1, ly1, + lx1, ly1 + yoff, lx1 + halfx, ly1 + halfy, + lx2, ly2 - yoff, lx2, ly2, + (issignal ? "$signal_cord" : "$msg_cord"), + (issignal ? "$signal_cord_width" : "$msg_cord_width"), + tag); + +} + +void canvas_updateconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag) { + int halfx = (lx2 - lx1)/2; + int halfy = (ly2 - ly1)/2; + int yoff = abs((halfy+halfy)/2); + if (yoff < 2) yoff = 2; + if (yoff > 20) yoff = 20; + if (tag) { + //sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n", x, tag, lx1, ly1, lx2, ly2); + //bezier curves FTW + sys_vgui(".x%lx.c coords l%lx \"M %d %d Q %d %d %d %d Q %d %d %d %d\"\n", + x, tag, lx1, ly1, + lx1, ly1 + yoff, lx1 + halfx, ly1 + halfy, + lx2, ly2 - yoff, lx2, ly2); + } else { + //sys_vgui(".x%lx.c coords x %d %d %d %d\n", x, lx1, ly1, lx2, ly2); + //bezier curves FTW + sys_vgui(".x%lx.c coords x \"M %d %d Q %d %d %d %d Q %d %d %d %d\"\n", + x, lx1, ly1, + lx1, ly1 + yoff, lx1 + halfx, ly1 + halfy, + lx2, ly2 - yoff, lx2, ly2); + } +} + int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2, int closest1, int closest2, int multi, int create_undo) { int x11=0, y11=0, x12=0, y12=0; @@ -3371,15 +3471,17 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2, int closest1, int ((x22-x21-IOWIDTH) * closest2)/(ninlet2-1) : 0) + IOMIDDLE; ly2 = y21; - sys_vgui(".x%lx.c create line %d %d %d %d -fill %s -width %s -tags {l%lx all_cords}\n", + + canvas_drawconnection(x, lx1, ly1, lx2, ly2, (t_int)oc, issignal); + /*sys_vgui(".x%lx.c create polyline %d %d %d %d -stroke %s -strokewidth %s -tags {l%lx all_cords}\n", glist_getcanvas(x), lx1, ly1, lx2, ly2, (issignal ? "$signal_cord" : "$msg_cord"), (issignal ? "$signal_cord_width" : "$msg_cord_width"), - oc); + oc);*/ if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (obj_issignalinlet(ob2, closest2) ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3391,7 +3493,7 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2, int closest1, int } if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0 && !glob_shift) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3812,10 +3914,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) ywas = x->gl_editor->e_ywas; if (doit && !glob_shift) sys_vgui(".x%lx.c delete x\n", x); else { - - sys_vgui(".x%lx.c coords x %d %d %d %d\n", - x, x->gl_editor->e_xwas, - x->gl_editor->e_ywas, xpos, ypos); + canvas_updateconnection(x, x->gl_editor->e_xwas, x->gl_editor->e_ywas, xpos, ypos, 0); sys_vgui("pdtk_check_scroll_on_motion .x%lx.c 0\n", x); } @@ -3865,7 +3964,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) t_rtext *y = glist_findrtext(x, (t_text *)&ob2->ob_g); if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -3878,7 +3977,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) "%si%d", rtext_gettag(y), closest2); - sys_vgui(".x%x.c itemconfigure %s -outline $select_nlet_color -width $highlight_width\n", + sys_vgui(".x%x.c itemconfigure %s -stroke $select_nlet_color -strokewidth $highlight_width\n", x, x->gl_editor->canvas_cnct_inlet_tag); //sys_vgui(".x%x.c raise %s\n", @@ -3900,7 +3999,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) // jsarlo if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -4077,20 +4176,24 @@ void canvas_mouseup(t_canvas *x, //} } sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); - } + } else if (x->gl_editor->e_onmotion == MA_SCROLL) { + sys_vgui("pdtk_canvas_scroll_xy_click .x%lx %d %d 0\n", (t_int)x, (int)fxpos, (int)fypos); + x->gl_editor->e_onmotion = MA_NONE; + canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); + } if (x->gl_editor->e_onmotion != MA_CONNECT || x->gl_editor->e_onmotion == MA_CONNECT && !glob_shift) { //fprintf(stderr,"releasing shift during connect without the button pressed\n"); if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); } if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -4099,9 +4202,46 @@ void canvas_mouseup(t_canvas *x, x->gl_editor->e_onmotion = MA_NONE; } + //fprintf(stderr,"canvas_mouseup -> canvas_doclick %d\n", which); canvas_doclick(x, xpos, ypos, 0, (glob_shift + glob_ctrl*2 + glob_alt*4), 0); } +void canvas_mousedown_middle(t_canvas *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg which, t_floatarg mod) +{ + int shiftmod, runmode, altmod, rightclick, middleclick; + + // remove stale tooltips, if any + if (objtooltip) { + objtooltip = 0; + sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x); + } + + // read key and mouse button states + shiftmod = ((int)mod & SHIFTMOD); + runmode = (((int)mod & CTRLMOD) || (!x->gl_edit)); + altmod = ((int)mod & ALTMOD); + rightclick = ((int)mod & RIGHTCLICK); + x->gl_editor->e_xwas = (int)xpos; + x->gl_editor->e_ywas = (int)ypos; + middleclick = (which == 2 ? 1 : 0); + + /* let's check if we are not middle-clicking */ + //fprintf(stderr,"middleclick=%d doit=%d\n", middleclick, doit); + if (middleclick) + { + if (x->gl_editor && x->gl_editor->e_textedfor) { + canvas_mousedown(x, xpos, ypos, which, mod); + canvas_mouseup(x, xpos, ypos, which); + sys_vgui("pdtk_pastetext\n"); + } else { + sys_vgui("pdtk_canvas_scroll_xy_click .x%lx %d %d 3\n", (t_int)x, (int)xpos, (int)ypos); + x->gl_editor->e_onmotion = MA_SCROLL; + canvas_setcursor(x, CURSOR_SCROLL); + } + } +} + /* displace the selection by (dx, dy) pixels */ static void canvas_displaceselection(t_canvas *x, int dx, int dy) { @@ -4463,7 +4603,11 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, else post("not resizable"); } } - else canvas_doclick(x, xpos, ypos, 0, mod, 0); + else if (x->gl_editor->e_onmotion == MA_SCROLL) { fprintf(stderr,"canvas_motion MA_SCROLL\n"); } + else { + //fprintf(stderr,"canvas_motion -> doclick %d\n", x->gl_editor->e_onmotion); + canvas_doclick(x, xpos, ypos, 0, mod, 0); + } //if (toggle_moving == 1) { // sys_vgui("pdtk_update_xy_tooltip .x%lx %d %d\n", x, (int)xpos, (int)ypos); //} @@ -5553,10 +5697,11 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, if (glist_isvisible(x) && (pd_class(&sink->g_pd) != preset_node_class || (pd_class(&sink->g_pd) == preset_node_class && pd_class(&src->g_pd) == message_class))) { //fprintf(stderr,"draw line\n"); - sys_vgui(".x%lx.c create line %d %d %d %d -width %s -fill %s -tags {l%lx all_cords}\n", + canvas_drawconnection(x, 0, 0, 0, 0, (t_int)oc, obj_issignaloutlet(objsrc, outno)); + /*sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %s -stroke %s -tags {l%lx all_cords}\n", glist_getcanvas(x), 0, 0, 0, 0, (obj_issignaloutlet(objsrc, outno) ? "$signal_cord_width" : "$msg_cord_width"), - (obj_issignaloutlet(objsrc, outno) ? "$signal_cord" : "$msg_cord"), oc); + (obj_issignaloutlet(objsrc, outno) ? "$signal_cord" : "$msg_cord"), oc);*/ canvas_fixlinesfor(x, objsrc); } } @@ -6157,7 +6302,7 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease) // jsarlo if (x->gl_editor->canvas_cnct_inlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + 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 ? "black" : (inlet_issignal ? "$signal_cord" : "$msg_cord")), (inlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -6165,7 +6310,7 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease) } if (x->gl_editor->canvas_cnct_outlet_tag[0] != 0) { - sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n", + sys_vgui(".x%x.c itemconfigure %s -stroke %s -fill %s -strokewidth 1\n", x, x->gl_editor->canvas_cnct_outlet_tag, (last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")), (outlet_issignal ? "$signal_nlet" : "$msg_nlet")); @@ -6377,6 +6522,8 @@ void g_editor_setup(void) A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); class_addmethod(canvas_class, (t_method)canvas_mouseup, gensym("mouseup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); + class_addmethod(canvas_class, (t_method)canvas_mousedown_middle, gensym("mouse-2"), + A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); class_addmethod(canvas_class, (t_method)canvas_key, gensym("key"), A_GIMME, A_NULL); class_addmethod(canvas_class, (t_method)canvas_motion, gensym("motion"), diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index ec9672af14f9825c28898ebb59e183f25e12a12d..007dae40ac0ee1c031dd13ad6f16b489e42db810 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -800,8 +800,8 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) //} //fprintf(stderr,"tgt=.x%lx %d\n", (t_int)tgt, exception); - if (vis && canvas_showtext(x) && gobj_shouldvis(gr, parent_glist)) - rtext_draw(glist_findrtext(parent_glist, &x->gl_obj)); + if (vis && canvas_showtext(x) && gobj_shouldvis(gr, parent_glist)) + rtext_draw(glist_findrtext(parent_glist, &x->gl_obj)); graph_getrect(gr, parent_glist, &x1, &y1, &x2, &y2); //fprintf(stderr,"%d %d %d %d\n", x1, y1, x2, y2); if (!vis) @@ -816,11 +816,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) { if (vis && gobj_shouldvis(gr, parent_glist)) { - sys_vgui(".x%lx.c create polygon\ - %d %d %d %d %d %d %d %d %d %d -tags {%sfill %s} -fill $graph_outline\n", + sys_vgui(".x%lx.c create ppolygon\ + %d %d %d %d %d %d %d %d %d %d -tags {%sfill} -fill $graph_outline\n", glist_getcanvas(x->gl_owner), //parent_glist, - x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag, tag); + x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag); } else if (gobj_shouldvis(gr, parent_glist)) { @@ -839,10 +839,14 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) t_symbol *arrayname; t_garray *ga; /* draw a rectangle around the graph */ - sys_vgui(".x%lx.c create line\ - %d %d %d %d %d %d %d %d %d %d -fill $graph_outline -tags {%sR %s}\n", + /*sys_vgui(".x%lx.c create polyline\ + %d %d %d %d %d %d %d %d %d %d -stroke $graph_outline -tags {%sR %s}\n", glist_getcanvas(x->gl_owner), - x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag, tag); + x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag, tag);*/ + sys_vgui(".x%lx.c create prect\ + %d %d %d %d -stroke $graph_outline -tags {%sR}\n", + glist_getcanvas(x->gl_owner), + x1, y1, x2, y2, tag); /* if there's just one "garray" in the graph, write its name along the top */ @@ -853,7 +857,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) //i -= sys_fontheight(glist_getfont(x)); i++; sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor nw\ - -font {{%s} %d %s} -tags %s -fill %s\n", + -font {{%s} %d %s} -tags {%s} -fill %s\n", (long)glist_getcanvas(x), x1+2, i, arrayname->s_name, sys_font, sys_hostfontsize(glist_getfont(x)), sys_fontweight, tag, (glist_isselected(x, gr) ? "$select_color" : "$graph_outline")); @@ -872,11 +876,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) f += x->gl_xtick.k_inc) { int tickpix = (i % x->gl_xtick.k_lperb ? 2 : 4); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), (int)glist_xtopixels(x, f), (int)upix, (int)glist_xtopixels(x, f), (int)upix - tickpix, tag); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), (int)glist_xtopixels(x, f), (int)lpix, (int)glist_xtopixels(x, f), (int)lpix + tickpix, tag); @@ -886,11 +890,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) i++, f -= x->gl_xtick.k_inc) { int tickpix = (i % x->gl_xtick.k_lperb ? 2 : 4); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), (int)glist_xtopixels(x, f), (int)upix, (int)glist_xtopixels(x, f), (int)upix - tickpix, tag); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), (int)glist_xtopixels(x, f), (int)lpix, (int)glist_xtopixels(x, f), (int)lpix + tickpix, tag); @@ -909,11 +913,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) i++, f += x->gl_ytick.k_inc) { int tickpix = (i % x->gl_ytick.k_lperb ? 2 : 4); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), x1, (int)glist_ytopixels(x, f), x1 + tickpix, (int)glist_ytopixels(x, f), tag); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), x2, (int)glist_ytopixels(x, f), x2 - tickpix, (int)glist_ytopixels(x, f), tag); @@ -923,11 +927,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) i++, f -= x->gl_ytick.k_inc) { int tickpix = (i % x->gl_ytick.k_lperb ? 2 : 4); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), x1, (int)glist_ytopixels(x, f), x1 + tickpix, (int)glist_ytopixels(x, f), tag); - sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), x2, (int)glist_ytopixels(x, f), x2 - tickpix, (int)glist_ytopixels(x, f), tag); @@ -936,7 +940,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) /* draw x labels */ for (i = 0; i < x->gl_nxlabels; i++) sys_vgui(".x%lx.c create text\ - %d %d -text {%s} -font {{%s} %d %s} -tags %s\n", + %d %d -text {%s} -font {{%s} %d %s} -tags {%s}\n", glist_getcanvas(x), (int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)), (int)glist_ytopixels(x, x->gl_xlabely), @@ -946,7 +950,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) /* draw y labels */ for (i = 0; i < x->gl_nylabels; i++) sys_vgui(".x%lx.c create text\ - %d %d -text {%s} -font {{%s} %d %s} -tags %s\n", + %d %d -text {%s} -font {{%s} %d %s} -tags {%s}\n", glist_getcanvas(x), (int)glist_xtopixels(x, x->gl_ylabelx), (int)glist_ytopixels(x, atof(x->gl_ylabel[i]->s_name)), @@ -1189,18 +1193,18 @@ static void graph_select(t_gobj *z, t_glist *glist, int state) canvas = glist; } if(glist_istoplevel(glist)) { - sys_vgui(".x%lx.c itemconfigure %sR -fill %s\n", canvas, + sys_vgui(".x%lx.c itemconfigure %sR -stroke %s\n", canvas, rtext_gettag(y), (state? "$select_color" : "$graph_outline")); /* sys_vgui(".x%lx.c itemconfigure graph%lx -fill %s\n", glist_getcanvas(glist), z, (state? "$select_color" : "$graph_outline")); */ - sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", + sys_vgui(".x%lx.c itemconfigure %sT -fill %s\n", canvas, rtext_gettag(y), (state? "$select_color" : "$graph_outline")); - sys_vgui(".x%lx.c itemconfigure %sfill -fill %s\n", + sys_vgui(".x%lx.c itemconfigure %sfill -stroke %s\n", canvas, rtext_gettag(y), (state? "$select_color" : "$graph_outline")); } diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c index 523c8cbde6cd13396f11210da9da8446051a0ca7..c36fe2d60473f1a03056b33bb27587f3e888ad16 100644 --- a/pd/src/g_hdial.c +++ b/pd/src/g_hdial.c @@ -45,10 +45,10 @@ void hradio_draw_update(t_gobj *client, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, x->x_drawn, x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, x->x_on, x->x_gui.x_fcol, x->x_gui.x_fcol); x->x_drawn = x->x_on; @@ -86,10 +86,10 @@ void hradio_draw_new(t_hradio *x, t_glist *glist) for(i=0; i<n; i++) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE%d %lxHRDO %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE%d %lxHRDO %lx text}\n", canvas, xx11, yy11, xx11+dx, yy12, x->x_gui.x_bcol, x, i, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags {%lxBUT%d %lxHRDO %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x -tags {%lxBUT%d %lxHRDO %lx text}\n", canvas, xx21, yy21, xx22, yy22, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, i, x, x); @@ -105,10 +105,10 @@ void hradio_draw_new(t_hradio *x, t_glist *glist) x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %lx outlet}\n", canvas, xx11b, yy12-1, xx11b + IOWIDTH, yy12, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %lx inlet}\n", canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, nlet_tag, 0, nlet_tag, 0, x, x); //} } @@ -217,7 +217,7 @@ void hradio_draw_config(t_hradio* x, t_glist* glist) strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); for(i=0; i<n; i++) { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -fill #%6.6x\n .x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBASE%d -fill #%6.6x\n .x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, i, x->x_gui.x_bcol, canvas, x, i, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); @@ -249,7 +249,7 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_w-1, xpos + IOWIDTH, ypos + x->x_gui.x_w, @@ -257,7 +257,7 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxHRDO%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %lx inlet}\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); @@ -283,7 +283,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist) for(i=0; i<n; i++) { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline $select_color\n", canvas, x, i); + sys_vgui(".x%lx.c itemconfigure %lxBASE%d -stroke $select_color\n", canvas, x, i); } sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); @@ -337,7 +337,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist) sys_vgui(".x%lx.c dtag %lxHRDO selected\n", canvas, x); for(i=0; i<n; i++) { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline #%6.6x\n", canvas, x, i, + sys_vgui(".x%lx.c itemconfigure %lxBASE%d -stroke #%6.6x\n", canvas, x, i, IEM_GUI_COLOR_NORMAL); } sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, @@ -412,8 +412,8 @@ static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + (x->x_gui.x_w * x->x_number), x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag); diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c index fadb52efe6b1fe48a427d11193a49bb6bc454e96..046a42199fe3fceadccdeb4ef885f054d74a40a8 100644 --- a/pd/src/g_hslider.c +++ b/pd/src/g_hslider.c @@ -49,12 +49,12 @@ static void hslider_draw_update(t_gobj *client, t_glist *glist) int r = text_xpix(&x->x_gui.x_obj, glist) + 3 + (x->x_val + 50)/100; sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", canvas, x, r, ypos+2, - r, ypos + x->x_gui.x_h-1); + r, ypos + x->x_gui.x_h-2); if(x->x_val == x->x_center) { if(!x->x_thick) { - sys_vgui(".x%lx.c itemconfigure %lxKNOB -width 7\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth 7\n", canvas, x); x->x_thick = 1; } } @@ -62,7 +62,7 @@ static void hslider_draw_update(t_gobj *client, t_glist *glist) { if(x->x_thick) { - sys_vgui(".x%lx.c itemconfigure %lxKNOB -width 3\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth 3\n", canvas, x); x->x_thick = 0; } } @@ -96,13 +96,13 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist) if (yyyy) nlet_tag = rtext_gettag(yyyy); else nlet_tag = "bogus"; - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxHSLDR %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxHSLDR %lx text}\n", canvas, xpos, ypos, xpos + x->x_gui.x_w+5, ypos + x->x_gui.x_h, x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width 3 -fill #%6.6x -tags {%lxKNOB %lxHSLDR %lx text}\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 -stroke #%6.6x -tags {%lxKNOB %lxHSLDR %lx text}\n", canvas, r, ypos+2, r, - ypos + x->x_gui.x_h-1, x->x_gui.x_fcol, x, x, x); + ypos + x->x_gui.x_h-2, x->x_gui.x_fcol, x, x, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxHSLDR %lx text}\n", canvas, xpos+x->x_gui.x_ldx, @@ -111,11 +111,11 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist) x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHSLDR%so%d %so%d %lxHSLDR %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHSLDR%so%d %so%d %lxHSLDR %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos+7, ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHSLDR%si%d %si%d %lxHSLDR %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHSLDR%si%d %si%d %lxHSLDR %lx inlet}\n", canvas, xpos, ypos, xpos+7, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); //} @@ -149,7 +149,7 @@ static void hslider_draw_move(t_hslider *x, t_glist *glist) xpos + x->x_gui.x_w+5, ypos + x->x_gui.x_h); sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", canvas, x, r, ypos+2, - r, ypos + x->x_gui.x_h-1); + r, ypos + x->x_gui.x_h-2); sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) @@ -215,7 +215,7 @@ static void hslider_draw_config(t_hslider* x,t_glist* glist) canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxKNOB -fill #%6.6x\n .x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n .x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol, canvas, x, x->x_gui.x_bcol); //sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); } @@ -242,13 +242,13 @@ static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHSLDR%so%d %so%d %lxHSLDR %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHSLDR%so%d %so%d %lxHSLDR %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos+7, ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxHSLDR%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHSLDR%si%d %si%d %lxHSLDR %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHSLDR%si%d %si%d %lxHSLDR %lx inlet}\n", canvas, xpos, ypos, xpos+7, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) @@ -270,7 +270,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); if (x->x_gui.scale_vis) { @@ -321,7 +321,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist) } else { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); sys_vgui(".x%lx.c dtag %lxHSLDR selected\n", canvas, x); sys_vgui("destroy %s\n", sh->h_pathname); @@ -401,8 +401,8 @@ static void hslider__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + 5 + x->x_gui.x_w, x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag); diff --git a/pd/src/g_magicglass.c b/pd/src/g_magicglass.c index aeb3de562b8cdc606925603b3c8927dcc3f1f1ad..1a5925731d58571bae97d9ed842905b7af1ef2d5 100644 --- a/pd/src/g_magicglass.c +++ b/pd/src/g_magicglass.c @@ -112,9 +112,9 @@ void magicGlass_updateText(t_magicGlass *x, int moved) void magicGlass_drawNew(t_magicGlass *x) { //fprintf(stderr,"magicglass_drawNew\n"); - sys_vgui(".x%x.c create rectangle 0 0 0 0 -outline #000000 -fill #000000 -tags magicGlassBg\n", + sys_vgui(".x%x.c create prect 0 0 0 0 -stroke #000000 -fill #000000 -tags magicGlassBg\n", x->x_c); - sys_vgui(".x%x.c create polygon 0 0 0 0 0 0 -fill #000000 -width 4 -tags magicGlassLine\n", + sys_vgui(".x%x.c create ppolygon 0 0 0 0 0 0 -fill #000000 -strokewidth 4 -tags magicGlassLine\n", x->x_c); sys_vgui(".x%x.c create text 0 0 -text {} -anchor w -fill #e87216 -font {{%s} -%d %s} -tags magicGlassText\n", x->x_c, sys_font, x->x_display_font, sys_fontweight); diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index 3f2bffad8ce933b12e79349c2ffaebf1a982796a..cef0202649da37a2a4c7299ba2e2a89b7563cf72 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -49,11 +49,11 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist) //if (glist_isvisible(glist)) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags {%lxRECT %lxMYCNV %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x -tags {%lxRECT %lxMYCNV %lx text}\n", canvas, xpos, ypos, xpos + x->x_vis_w, ypos + x->x_vis_h, x->x_gui.x_bcol, x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline #%6.6x -tags {%lxBASE %lxMYCNV %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -stroke #%6.6x -tags {%lxBASE %lxMYCNV %lx text}\n", canvas, xpos, ypos, xpos + x->x_gui.x_w, ypos + x->x_gui.x_h, x->x_gui.x_bcol, x, x, x); @@ -121,12 +121,12 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) sprintf(color, "#%6.6x", x->x_gui.x_bcol); */ - sys_vgui(".x%lx.c itemconfigure %lxRECT -fill #%6.6x -outline #%6.6x\n", canvas, x, + sys_vgui(".x%lx.c itemconfigure %lxRECT -fill #%6.6x -stroke #%6.6x\n", canvas, x, x->x_gui.x_bcol, x->x_gui.x_bcol); if (x->x_gui.x_fsf.x_selected && x->x_gui.x_glist == canvas) - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); else - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, x->x_gui.x_bcol); sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, @@ -148,7 +148,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); if (x->x_gui.scale_vis) { sys_vgui("destroy %s\n", sh->h_pathname); @@ -198,7 +198,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) } else { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, x->x_gui.x_bcol); sys_vgui(".x%lx.c dtag %lxMYCNV selected\n", canvas, x); sys_vgui("destroy %s\n", sh->h_pathname); sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x); @@ -274,8 +274,8 @@ static void my_canvas__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_vis_w, x->x_gui.x_obj.te_ypix + x->x_vis_h, sh->h_outlinetag); diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index de511e44473f67a03f1bcc9a53b2af133c6baf69..7fc02326975152c0896e21e6006bc7221ba8d658 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -215,7 +215,7 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) if (x->x_hide_frame <= 1) { sys_vgui( - ".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x \ + ".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d -stroke #%6.6x \ -fill #%6.6x -tags {%lxBASE1 %lxNUM %lx text}\n", canvas, xpos, ypos, xpos + x->x_numwidth-4, ypos, @@ -224,20 +224,20 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) xpos, ypos + x->x_gui.x_h, IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxNUM%so%d %so%d %lxNUM %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxNUM%so%d %so%d %lxNUM %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos+IOWIDTH, ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxNUM%si%d %si%d %lxNUM %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxNUM%si%d %si%d %lxNUM %lx inlet}\n", canvas, xpos, ypos, xpos+IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); } else { sys_vgui( - ".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x \ + ".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d -stroke #%6.6x \ -fill #%6.6x -tags {%lxBASE1 %lxNUM %lx text}\n", canvas, xpos, ypos, xpos + x->x_numwidth-4, ypos, @@ -248,7 +248,7 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) } if (!x->x_hide_frame || x->x_hide_frame == 2) sys_vgui( - ".x%lx.c create line %d %d %d %d %d %d -fill #%6.6x -tags {%lxBASE2 %lxNUM %lx text}\n", + ".x%lx.c create polyline %d %d %d %d %d %d -stroke #%6.6x -tags {%lxBASE2 %lxNUM %lx text}\n", canvas, xpos, ypos, xpos + half, ypos + half, xpos, ypos + x->x_gui.x_h, @@ -367,7 +367,7 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) */ if (x->x_gui.x_fsf.x_selected && x->x_gui.x_glist == canvas) { - sys_vgui(" .x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill $select_color -text {%s} \n .x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill $select_color \n .x%lx.c itemconfigure %lxBASE2 -fill $select_color\n", + sys_vgui(" .x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill $select_color -text {%s} \n .x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill $select_color \n .x%lx.c itemconfigure %lxBASE2 -stroke $select_color\n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, @@ -380,7 +380,7 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) */ } else { - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n .x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill #%6.6x \n .x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n .x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill #%6.6x \n .x%lx.c itemconfigure %lxBASE2 -stroke #%6.6x\n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, @@ -417,7 +417,7 @@ static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_fla else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxNUM%so%d %so%d %lxNUM %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxNUM%so%d %so%d %lxNUM %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos+IOWIDTH, ypos + x->x_gui.x_h, @@ -425,7 +425,7 @@ static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_fla if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxNUM%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxNUM%si%d %si%d %lxNUM %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxNUM%si%d %si%d %lxNUM %lx inlet}\n", canvas, xpos, ypos, xpos+IOWIDTH, ypos+1, @@ -458,9 +458,9 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline $select_color\n", + sys_vgui(".x%lx.c itemconfigure %lxBASE1 -stroke $select_color\n", canvas, x); - sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill $select_color\n", + sys_vgui(".x%lx.c itemconfigure %lxBASE2 -stroke $select_color\n", canvas, x); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); @@ -517,12 +517,12 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) sys_vgui(".x%lx.c dtag %lxNUM selected\n", canvas, x); if (x->x_hide_frame <= 1) - sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBASE1 -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - else sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline #%6.6x\n", + else sys_vgui(".x%lx.c itemconfigure %lxBASE1 -stroke #%6.6x\n", canvas, x, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBASE2 -stroke #%6.6x\n", canvas, x, x->x_gui.x_fcol); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); @@ -599,8 +599,8 @@ static void my_numbox__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_numwidth, x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag); diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index b39195c888d6034c96ea6d8c7ba58258f10d152b..65657a9aa84a5ea167d608116a79a9fe50ca92f5 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -24,7 +24,7 @@ #define TMARGIN 3 #define BMARGIN 1 #else -#define TMARGIN 4 +#define TMARGIN 3 #define BMARGIN 0 #endif diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index 2e741198838f0681b5c857f022e0b3188a078ac2..30586f4780896ed73a4aa57eb2bb81312b334827 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -206,8 +206,8 @@ static void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) scalar_getrect(&x->sc_gobj, glist, &x1, &y1, &x2, &y2); x1--; x2++; y1--; y2++; if (glist_istoplevel(glist)) - sys_vgui(".x%lx.c create line %d %d %d %d %d %d %d %d %d %d \ - -width 0 -fill $select_color -tags {select%lx selected}\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d %d %d %d %d %d %d \ + -strokewidth 0 -fill $select_color -tags {select%lx selected}\n", glist_getcanvas(glist), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, x); } @@ -363,7 +363,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) { int x1 = glist_xtopixels(owner, basex); int y1 = glist_ytopixels(owner, basey); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lx scalar%lx}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lx scalar%lx}\n", glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x, x); } else sys_vgui(".x%lx.c delete scalar%lx\n", glist_getcanvas(owner), x); diff --git a/pd/src/g_template.c b/pd/src/g_template.c index d145cd4acb3118fbe9c64eb1b8e90670fbf78dcf..c70df4126f7264302717f85cd6a94411d72e5f51 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -1173,19 +1173,27 @@ static void curve_vis(t_gobj *z, t_glist *glist, numbertocolor( fielddesc_getfloat(&x->x_fillcolor, template, data, 1), fill); - sys_vgui(".x%lx.c create polygon\\\n", + sys_vgui(".x%lx.c create ppolygon\\\n", glist_getcanvas(glist)); } - else sys_vgui(".x%lx.c create line\\\n", glist_getcanvas(glist)); + else sys_vgui(".x%lx.c create polyline\\\n", glist_getcanvas(glist)); for (i = 0; i < n; i++) sys_vgui("%d %d\\\n", pix[2*i], pix[2*i+1]); - sys_vgui("-width %f\\\n", width); - if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n", + sys_vgui("-strokewidth %f\\\n", width); + if (flags & CLOSED) sys_vgui("-fill %s -stroke %s\\\n", fill, outline); - else sys_vgui("-fill %s\\\n", outline); - if (flags & BEZ) sys_vgui("-smooth 1\\\n"); + else sys_vgui("-stroke %s\\\n", outline); + //if (flags & BEZ) sys_vgui("-smooth 1\\\n"); //this doesn't work with tkpath sys_vgui("-tags {.x%lx.x%lx.curve%lx %lx}\n", glist_getcanvas(glist), glist, data, (t_int)tag); + if (!glist_istoplevel(glist)) { + t_canvas *gl = glist_getcanvas(glist); + //glist_noselect(gl); + //glist_select(gl, (t_gobj *)glist); + char objtag[64]; + sprintf(objtag, ".x%lx.x%lx.curve%lx", (t_int)gl, (t_int)glist, (t_int)data); + canvas_restore_original_position(gl, (t_gobj *)glist, objtag, -1); + } } else post("warning: curves need at least two points to be graphed"); } @@ -1672,7 +1680,6 @@ static void plot_vis(t_gobj *z, t_glist *glist, int tovis) { t_plot *x = (t_plot *)z; - // get the universal tag for all nested objects t_canvas *tag = x->x_canvas; while (tag->gl_owner) { @@ -1761,7 +1768,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, if (draw_me) {*/ //we subtract 1 from y to keep it in sync with the rest of the types of templates sys_vgui( - ".x%lx.c create rectangle %d %d %d %d -fill black -width 0 -tags {.x%lx.x%lx.plot%lx %lx}\n", + ".x%lx.c create prect %d %d %d %d -fill black -strokewidth 0 -tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), ixpix, (int)glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, minyval)) - 1, @@ -1790,7 +1797,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, { /* found "w" field which controls linewidth. The trace is a filled polygon with 2n points. */ - sys_vgui(".x%lx.c create polygon \\\n", + sys_vgui(".x%lx.c create ppolygon \\\n", glist_getcanvas(glist)); for (i = 0, xsum = xloc; i < nelem; i++) @@ -1858,9 +1865,9 @@ static void plot_vis(t_gobj *z, t_glist *glist, fielddesc_cvttocoord(wfielddesc, wval))); } ouch: - sys_vgui(" -width 1 -fill %s -outline %s\\\n", - outline, outline); - if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n"); + sys_vgui(" -strokewidth 1 -stroke %s\\\n", + outline); + //if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n"); //this doesn't work with tkpath sys_vgui("-tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), glist, data, (t_int)tag); @@ -1870,7 +1877,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, /* no "w" field. If the linewidth is positive, draw a segmented line with the requested width; otherwise don't draw the trace at all. */ - sys_vgui(".x%lx.c create line \\\n", glist_getcanvas(glist)); + sys_vgui(".x%lx.c create polyline \\\n", glist_getcanvas(glist)); for (xsum = xloc, i = 0; i < nelem; i++) { @@ -1902,9 +1909,9 @@ static void plot_vis(t_gobj *z, t_glist *glist, glist_ytopixels(glist, basey + yloc + fielddesc_cvttocoord(yfielddesc, yval))); - sys_vgui("-width %f\\\n", linewidth); - sys_vgui("-fill %s\\\n", outline); - if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n"); + sys_vgui("-strokewidth %f\\\n", linewidth); + //sys_vgui("-fill %s\\\n", outline); + //if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n"); //this doesn't work with tkpath sys_vgui("-tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), glist, data, (t_int)tag); } @@ -1937,6 +1944,10 @@ static void plot_vis(t_gobj *z, t_glist *glist, } } } + if (!glist_istoplevel(glist)) { + sys_vgui(".x%lx.c lower .x%lx.x%lx.plot%lx %s\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data, rtext_gettag(glist_findrtext(glist_getcanvas(glist), &glist->gl_obj))); + sys_vgui(".x%lx.c raise .x%lx.x%lx.plot%lx %s\n", glist_getcanvas(glist), glist_getcanvas(glist), glist, data, rtext_gettag(glist_findrtext(glist_getcanvas(glist), &glist->gl_obj))); + } } else { diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 91593669d20028a6dab671ab5da62f13cc85b2e8..bcad87d3280a862250f3dd5985d34c6c93b48c2a 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -602,7 +602,7 @@ static void message_click(t_message *x, if (glist_isvisible(x->m_glist)) { t_rtext *y = glist_findrtext(x->m_glist, &x->m_text); - sys_vgui(".x%lx.c itemconfigure %sR -width 5\n", + sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 5\n", glist_getcanvas(x->m_glist), rtext_gettag(y)); clock_delay(x->m_clock, 120); } @@ -613,7 +613,7 @@ static void message_tick(t_message *x) if (glist_isvisible(x->m_glist)) { t_rtext *y = glist_findrtext(x->m_glist, &x->m_text); - sys_vgui(".x%lx.c itemconfigure %sR -width 1\n", + sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 1\n", glist_getcanvas(x->m_glist), rtext_gettag(y)); } } @@ -1369,6 +1369,7 @@ static void text_select(t_gobj *z, t_glist *glist, int state) t_rtext *y = glist_findrtext(glist, x); char *outline; rtext_select(y, state); + //fprintf(stderr,"text_select %s\n", rtext_gettag(y)); if (pd_class(&x->te_pd) == text_class) outline = "$dash_outline"; else @@ -1376,7 +1377,7 @@ static void text_select(t_gobj *z, t_glist *glist, int state) //fprintf(stderr,"text_select isvisible=%d shouldvis=%d istoplevel=%d\n", glist_isvisible(glist), gobj_shouldvis(&x->te_g, glist), glist_istoplevel(glist)); if (gobj_shouldvis(&x->te_g, glist)) { if (glist_istoplevel(glist)) { - sys_vgui(".x%lx.c itemconfigure %sR -outline %s\n", glist_getcanvas(glist), + sys_vgui(".x%lx.c itemconfigure %sR -stroke %s\n", glist_getcanvas(glist), rtext_gettag(y), (state? "$select_color" : outline)); if (z->g_pd == gatom_class) { sys_vgui(".x%lx.c itemconfigure %lx.l -fill %s\n", glist_getcanvas(glist), @@ -1394,7 +1395,7 @@ static void text_select(t_gobj *z, t_glist *glist, int state) glist_getcanvas(glist), rtext_gettag(y)); if (pd_class(&x->te_pd) == text_class && glist_istoplevel(glist)) - sys_vgui(".x%lx.c itemconfigure %sR -width 1 -fill $obj_box_fill\n", + sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 1 -fill $obj_box_fill\n", glist_getcanvas(glist), rtext_gettag(y)); t_object *ob = pd_checkobject(&x->te_pd); @@ -1418,7 +1419,7 @@ static void text_select(t_gobj *z, t_glist *glist, int state) glist_getcanvas(glist), rtext_gettag(y)); if (pd_class(&x->te_pd) == text_class) - sys_vgui(".x%lx.c itemconfigure %sR -width 2 -fill %s\n", + sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 2 -fill %s\n", glist_getcanvas(glist), rtext_gettag(y), invalid_fill); @@ -1669,8 +1670,8 @@ 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 rectangle %d %d %d %d \ - -fill %s -outline %s -tags {%so%d %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d \ + -fill %s -stroke %s -tags {%so%d %lx outlet}\n", glist_getcanvas(glist), onset, y2 - 2, onset + IOWIDTH, y2, (issignal ? "$signal_nlet" : "$msg_nlet"), (issignal ? "$signal_cord" : "$msg_cord"), @@ -1699,8 +1700,8 @@ 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 rectangle %d %d %d %d \ - -fill %s -outline %s -tags {%si%d %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d \ + -fill %s -stroke %s -tags {%si%d %lx inlet}\n", glist_getcanvas(glist), onset, y1, onset + IOWIDTH, y1 + EXTRAPIX, (issignal ? "$signal_nlet" : "$msg_nlet"), (issignal ? "$signal_cord" : "$msg_cord"), @@ -1739,8 +1740,8 @@ void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime, { //fprintf(stderr,"drawiofor_withtag o firsttime\n"); issignal = obj_issignaloutlet(ob,i); - sys_vgui(".x%lx.c create rectangle %d %d %d %d \ - -fill %s -outline %s -tags {%so%d %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d \ + -fill %s -stroke %s -tags {%so%d %lx outlet}\n", glist_getcanvas(glist), onset, y2 - 2, onset + IOWIDTH, y2, (issignal ? "$signal_nlet" : "$msg_nlet"), (issignal ? "$signal_cord" : "$msg_cord"), @@ -1764,8 +1765,8 @@ void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime, { //fprintf(stderr,"drawiofor_withtag i firsttime\n"); issignal = obj_issignalinlet(ob,i); - sys_vgui(".x%lx.c create rectangle %d %d %d %d \ - -fill %s -outline %s -tags {%si%d %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d \ + -fill %s -stroke %s -tags {%si%d %lx inlet}\n", glist_getcanvas(glist), onset, y1, onset + IOWIDTH, y1 + EXTRAPIX, (issignal ? "$signal_nlet" : "$msg_nlet"), (issignal ? "$signal_cord" : "$msg_cord"), @@ -1820,7 +1821,7 @@ void text_drawborder(t_text *x, t_glist *glist, if (pd_class(&x->te_pd) == text_class) { pattern = "-"; - outline = "$dash_outline -width 2"; + outline = "$dash_outline -strokewidth 2"; fill = invalid_fill; } else @@ -1831,11 +1832,12 @@ void text_drawborder(t_text *x, t_glist *glist, } if (firsttime) { - sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d \ - -dash %s -outline %s -fill %s -tags {%sR %lx text}\n", + 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}\n", glist_getcanvas(glist), x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, - pattern, outline, fill, tag, tag); + outline, fill, tag, tag); + //-dash %s -> pattern disabled for tkpath } else { @@ -1851,8 +1853,8 @@ void text_drawborder(t_text *x, t_glist *glist, else if (x->te_type == T_MESSAGE) { if (firsttime) - sys_vgui(".x%lx.c create polygon\ - %d %d %d %d %d %d %d %d %d %d %d %d %d %d -outline $box_outline -fill $msg_box_fill -tags {%sR %lx text}\n", + sys_vgui(".x%lx.c create ppolygon\ + %d %d %d %d %d %d %d %d %d %d %d %d %d %d -stroke $box_outline -fill $msg_box_fill -tags {%sR %lx text}\n", glist_getcanvas(glist), x1, y1, x2+4, y1, x2, y1+4, x2, y2-4, x2+4, y2, x1, y2, x1, y1, @@ -1867,8 +1869,8 @@ void text_drawborder(t_text *x, t_glist *glist, else if (x->te_type == T_ATOM) { if (firsttime) - sys_vgui(".x%lx.c create polygon\ - %d %d %d %d %d %d %d %d %d %d %d %d -outline $box_outline -fill $atom_box_fill -tags {%sR %lx text}\n", + sys_vgui(".x%lx.c create ppolygon\ + %d %d %d %d %d %d %d %d %d %d %d %d -stroke $box_outline -fill $atom_box_fill -tags {%sR %lx text}\n", glist_getcanvas(glist), x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1, tag, tag); @@ -1904,7 +1906,7 @@ void text_drawborder_withtag(t_text *x, t_glist *glist, if (pd_class(&x->te_pd) == text_class) { pattern = "-"; - outline = "$dash_outline -width 2"; + outline = "$dash_outline -strokewidth 2"; fill = invalid_fill; } else @@ -1915,11 +1917,12 @@ void text_drawborder_withtag(t_text *x, t_glist *glist, } if (firsttime) { - sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d \ - -dash %s -outline %s -fill %s -tags {%sR %lx text}\n", + 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}\n", glist_getcanvas(glist), x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, - pattern, outline, fill, tag, tag); + outline, fill, tag, tag); + //-dash %s -> pattern disabled for tkpath } } else if (x->te_type == T_MESSAGE) @@ -1927,9 +1930,9 @@ void text_drawborder_withtag(t_text *x, t_glist *glist, msg_draw_const = ((y2-y1)/4); if (msg_draw_const > 10) msg_draw_const = 10; /* looks bad if too big */ if (firsttime) - sys_vgui(".x%lx.c create polygon \ + sys_vgui(".x%lx.c create ppolygon \ %d %d %d %d %d %d %d %d %d %d %d %d %d %d \ - -outline $box_outline -fill $msg_box_fill -tags {%sR %lx text}\n", + -stroke $box_outline -fill $msg_box_fill -tags {%sR %lx text}\n", glist_getcanvas(glist), x1, y1, x2+msg_draw_const, y1, x2, y1+msg_draw_const, x2, y2-msg_draw_const, x2+msg_draw_const, y2, @@ -1940,8 +1943,8 @@ void text_drawborder_withtag(t_text *x, t_glist *glist, { atom_draw_const = ((y2-y1)/3); if (firsttime) - sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d %d %d \ - -outline $box_outline -fill $atom_box_fill -tags {%sR %lx text}\n", + sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d %d %d \ + -stroke $box_outline -fill $atom_box_fill -tags {%sR %lx text}\n", glist_getcanvas(glist), x1, y1, x2-atom_draw_const, y1, x2, y1+atom_draw_const, x2, y2, x1, y2, x1, y1, diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 461cc23356d83552305a68c55fad922acc55f315..995b17bbee96f1c0f28c028c82d1320b848dfc3c 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -42,9 +42,9 @@ void toggle_draw_update(t_toggle *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxX1 -fill #%6.6x\n", canvas, x, + sys_vgui(".x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n", canvas, x, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxX2 -fill #%6.6x\n", canvas, x, + sys_vgui(".x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); } } @@ -79,13 +79,13 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) w = 2; if(x->x_gui.x_w >= 60) w = 3; - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxTGL %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxTGL %lx text}\n", canvas, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h, x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags {%lxX1 %lxTGL %lx text}\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -stroke #%6.6x -tags {%lxX1 %lxTGL %lx text}\n", canvas, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w, w, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags {%lxX2 %lxTGL %lx text}\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -stroke #%6.6x -tags {%lxX2 %lxTGL %lx text}\n", canvas, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w, w, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ @@ -96,10 +96,10 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxTGL%so%d %so%d %lxTGL %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxTGL%so%d %so%d %lxTGL %lx outlet}\n", canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxTGL%si%d %si%d %lxTGL %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxTGL%si%d %si%d %lxTGL %lx inlet}\n", canvas, xx, yy, xx + IOWIDTH, yy+1, x, nlet_tag, 0, nlet_tag, 0, x, x); //} } @@ -131,10 +131,10 @@ void toggle_draw_move(t_toggle *x, t_glist *glist) w = 3; sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h); - sys_vgui(".x%lx.c itemconfigure %lxX1 -width %d\n", canvas, x, w); + sys_vgui(".x%lx.c itemconfigure %lxX1 -strokewidth %d\n", canvas, x, w); sys_vgui(".x%lx.c coords %lxX1 %d %d %d %d\n", canvas, x, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w); - sys_vgui(".x%lx.c itemconfigure %lxX2 -width %d\n", canvas, x, w); + sys_vgui(".x%lx.c itemconfigure %lxX2 -strokewidth %d\n", canvas, x, w); sys_vgui(".x%lx.c coords %lxX2 %d %d %d %d\n", canvas, x, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w); sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", @@ -205,7 +205,7 @@ void toggle_draw_config(t_toggle* x, t_glist* glist) x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); } - sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n .x%lx.c itemconfigure %lxX1 -fill #%6.6x\n .x%lx.c itemconfigure %lxX2 -fill #%6.6x\n", canvas, x, + sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n .x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n .x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x, x->x_gui.x_bcol , canvas, x, x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol, canvas, x, x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); @@ -239,14 +239,14 @@ void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags) else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxTGL%so%d %so%d %lxTGL %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxTGL%so%d %so%d %lxTGL %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos + IOWIDTH, ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxTGL%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxTGL%si%d %si%d %lxTGL %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxTGL%si%d %si%d %lxTGL %lx outlet}\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) @@ -269,7 +269,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); if (x->x_gui.scale_vis) { @@ -320,7 +320,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist) } else { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); sys_vgui(".x%lx.c dtag %lxTGL selected\n", canvas, x); sys_vgui("destroy %s\n", sh->h_pathname); @@ -395,8 +395,8 @@ static void toggle__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_gui.x_w, x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag); diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c index 166362eb60fd7dfa2c1dee0a286171efd528a68f..c4321f864e57b176ed8502510f51341d595b43f5 100644 --- a/pd/src/g_vdial.c +++ b/pd/src/g_vdial.c @@ -42,10 +42,10 @@ void vradio_draw_update(t_gobj *client, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, x->x_drawn, x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, x->x_on, x->x_gui.x_fcol, x->x_gui.x_fcol); x->x_drawn = x->x_on; @@ -84,10 +84,10 @@ void vradio_draw_new(t_vradio *x, t_glist *glist) for(i=0; i<n; i++) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE%d %lxVRDO %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE%d %lxVRDO %lx text}\n", canvas, xx11, yy11, xx12, yy12, x->x_gui.x_bcol, x, i, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags {%lxBUT%d %lxVRDO %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x -tags {%lxBUT%d %lxVRDO %lx text}\n", canvas, xx21, yy21, xx22, yy22, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, i, x, x); @@ -104,10 +104,10 @@ void vradio_draw_new(t_vradio *x, t_glist *glist) x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVRDO%so%d %so%d %lxVRDO %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVRDO%so%d %so%d %lxVRDO %lx outlet}\n", canvas, xx11, yy11-1, xx11 + IOWIDTH, yy11, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVRDO%si%d %si%d %lxVRDO %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVRDO%si%d %si%d %lxVRDO %lx inlet}\n", canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, nlet_tag, 0, nlet_tag, 0, x, x); //} } @@ -216,7 +216,7 @@ void vradio_draw_config(t_vradio* x, t_glist* glist) strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); for(i=0; i<n; i++) { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -fill #%6.6x\n .x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxBASE%d -fill #%6.6x\n .x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, i, x->x_gui.x_bcol, canvas, x, i, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); @@ -248,7 +248,7 @@ void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVRDO%so%d %so%d %lxVRDO %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVRDO%so%d %so%d %lxVRDO %lx outlet}\n", canvas, xpos, ypos+(x->x_number*x->x_gui.x_h)-1, xpos+ IOWIDTH, @@ -256,7 +256,7 @@ void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxVRDO%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVRDO%si%d %si%d %lxVRDO %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVRDO%si%d %si%d %lxVRDO %lx inlet}\n", canvas, xpos, ypos, xpos+ IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); @@ -283,7 +283,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist) for(i=0; i<n; i++) { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline $select_color\n", canvas, x, i); + sys_vgui(".x%lx.c itemconfigure %lxBASE%d -stroke $select_color\n", canvas, x, i); } sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); @@ -338,7 +338,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist) for(i=0; i<n; i++) { sys_vgui(".x%lx.c dtag %lxVRDO selected\n", canvas, x); - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline #%6.6x\n", canvas, x, i, + sys_vgui(".x%lx.c itemconfigure %lxBASE%d -stroke #%6.6x\n", canvas, x, i, IEM_GUI_COLOR_NORMAL); } sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, @@ -413,8 +413,8 @@ static void vradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_gui.x_w, x->x_gui.x_obj.te_ypix + (x->x_gui.x_h * x->x_number), sh->h_outlinetag); diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c index ad211c43d8a33f9ae46804daa84da236ccf87e92..b1a4e8729f706124ada09900dc03d81546ea10d5 100644 --- a/pd/src/g_vslider.c +++ b/pd/src/g_vslider.c @@ -49,12 +49,12 @@ static void vslider_draw_update(t_gobj *client, t_glist *glist) sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", canvas, x, xpos+2, r, - xpos + x->x_gui.x_w-1, r); + xpos + x->x_gui.x_w-2, r); if(x->x_val == x->x_center) { if(!x->x_thick) { - sys_vgui(".x%lx.c itemconfigure %lxKNOB -width 7\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth 7\n", canvas, x); x->x_thick = 1; } } @@ -62,7 +62,7 @@ static void vslider_draw_update(t_gobj *client, t_glist *glist) { if(x->x_thick) { - sys_vgui(".x%lx.c itemconfigure %lxKNOB -width 3\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth 3\n", canvas, x); x->x_thick = 0; } } @@ -96,13 +96,13 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist) if (yyyy) nlet_tag = rtext_gettag(yyyy); else nlet_tag = "bogus"; - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxVSLDR %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxVSLDR %lx text}\n", canvas, xpos, ypos, xpos + x->x_gui.x_w, ypos + x->x_gui.x_h+5, x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width 3 -fill #%6.6x -tags {%lxKNOB %lxVSLDR %lx text}\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 -stroke #%6.6x -tags {%lxKNOB %lxVSLDR %lx text}\n", canvas, xpos+2, r, - xpos + x->x_gui.x_w-1, r, x->x_gui.x_fcol, x, x, x); + xpos + x->x_gui.x_w-2, r, x->x_gui.x_fcol, x, x, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxVSLDR %lx text}\n", canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, @@ -110,13 +110,13 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist) x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVSLDR%so%d %so%d %lxVSLDR %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVSLDR%so%d %so%d %lxVSLDR %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h+4, xpos+7, ypos + x->x_gui.x_h+5, x, nlet_tag, 0, nlet_tag, 0, x, x); if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVSLDR%si%d %si%d %lxVSLDR %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVSLDR%si%d %si%d %lxVSLDR %lx inlet}\n", canvas, xpos, ypos, xpos+7, ypos+1, @@ -152,7 +152,7 @@ static void vslider_draw_move(t_vslider *x, t_glist *glist) xpos + x->x_gui.x_w, ypos + x->x_gui.x_h+5); sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", canvas, x, xpos+2, r, - xpos + x->x_gui.x_w-1, r); + xpos + x->x_gui.x_w-2, r); sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) @@ -218,7 +218,7 @@ static void vslider_draw_config(t_vslider* x,t_glist* glist) canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxKNOB -fill #%6.6x\n .x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n .x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol, canvas, x, x->x_gui.x_bcol); /*sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol);*/ @@ -246,7 +246,7 @@ static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags) else nlet_tag = "bogus"; if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVSLDR%so%d %so%d %lxVSLDR %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVSLDR%so%d %so%d %lxVSLDR %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h+4, xpos+7, ypos + x->x_gui.x_h+5, @@ -254,7 +254,7 @@ static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags) if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxVSLDR%so%d\n", canvas, x, nlet_tag, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVSLDR%si%d %si%d %lxVSLDR %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVSLDR%si%d %si%d %lxVSLDR %lx inlet}\n", canvas, xpos, ypos, xpos+7, ypos+1, @@ -278,7 +278,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x); if (x->x_gui.scale_vis) { @@ -329,7 +329,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist) } else { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); sys_vgui(".x%lx.c dtag %lxVSLDR selected\n", canvas, x); sys_vgui("destroy %s\n", sh->h_pathname); @@ -409,8 +409,8 @@ static void vslider__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_gui.x_w, x->x_gui.x_obj.te_ypix + 5 + x->x_gui.x_h, sh->h_outlinetag); diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index 3732f7e25a9e033a4ba95944fe57fa21e1db4863..c09ad73885a6eebbfddc7d1eedaeb325834a4321 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -131,7 +131,7 @@ static void vu_draw_new(t_vu *x, t_glist *glist) if (yyyy) nlet_tag = rtext_gettag(yyyy); else nlet_tag = "bogus"; - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxVU %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxVU %lx text}\n", canvas, xpos, ypos, xpos+x->x_gui.x_w+2, ypos+x->x_gui.x_h+4, x->x_gui.x_bcol, x, x, x); @@ -139,8 +139,8 @@ static void vu_draw_new(t_vu *x, t_glist *glist) { led_col = iemgui_vu_col[i]; yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags {%lxRLED%d %lxVU %lx text}\n", - canvas, quad1+1, yyy+2, quad3+1, yyy+2, x->x_led_size, iemgui_color_hex[led_col], x, i, x, x); + sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -stroke #%6.6x -tags {%lxRLED%d %lxVU %lx text}\n", + canvas, quad1+1, yyy+2, quad3, yyy+2, x->x_led_size, iemgui_color_hex[led_col], x, i, x, x); if(((i+2)&3) && (x->x_scale)) sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags {%lxSCALE%d %lxVU %lx text}\n", @@ -158,10 +158,10 @@ static void vu_draw_new(t_vu *x, t_glist *glist) x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, i, x, x); } - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags {%lxRCOVER %lxVU %lx text}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x -tags {%lxRCOVER %lxVU %lx text}\n", canvas, quad1+1, ypos+1, quad3, ypos+1 + k1*IEM_VU_STEPS, x->x_gui.x_bcol, x->x_gui.x_bcol, x, x, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags {%lxPLED %lxVU %lx text}\n", + sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -fill #%6.6x -tags {%lxPLED %lxVU %lx text}\n", canvas, mid+1, ypos+12, mid+1, ypos+12, x->x_led_size, x->x_gui.x_bcol, x, x, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ @@ -172,12 +172,12 @@ static void vu_draw_new(t_vu *x, t_glist *glist) x->x_gui.x_lcol, x, x, x); if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h+3, xpos + IOWIDTH, ypos + x->x_gui.x_h+4, x, nlet_tag, 0, nlet_tag, 0, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", canvas, xpos+x->x_gui.x_w+2-IOWIDTH, ypos + x->x_gui.x_h+3, xpos+x->x_gui.x_w+2, ypos + x->x_gui.x_h+4, @@ -185,12 +185,12 @@ static void vu_draw_new(t_vu *x, t_glist *glist) } if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx inlet}\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx inlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx inlet}\n", canvas, xpos+x->x_gui.x_w+2-IOWIDTH, ypos, xpos+x->x_gui.x_w+2, ypos+1, @@ -236,7 +236,7 @@ static void vu_draw_move(t_vu *x, t_glist *glist) { yyy = k4 + k1*(k2-i); sys_vgui(".x%lx.c coords %lxRLED%d %d %d %d %d\n", - canvas, x, i, quad1+1, yyy+2, quad3+1, yyy+2); + canvas, x, i, quad1+1, yyy+2, quad3, yyy+2); if(((i+2)&3) && (x->x_scale)) sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", canvas, x, i, end+1, yyy+k3+2); @@ -341,7 +341,7 @@ static void vu_draw_config(t_vu* x, t_glist* glist) for(i=1; i<=IEM_VU_STEPS; i++) { - sys_vgui(".x%lx.c itemconfigure %lxRLED%d -width %d\n", canvas, x, i, + sys_vgui(".x%lx.c itemconfigure %lxRLED%d -strokewidth %d\n", canvas, x, i, x->x_led_size); if(((i+2)&3) && (x->x_scale)) if (x->x_gui.x_fsf.x_selected) @@ -377,7 +377,7 @@ static void vu_draw_config(t_vu* x, t_glist* glist) x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxRCOVER -fill #%6.6x -outline #%6.6x\n .x%lx.c itemconfigure %lxPLED -width %d\n .x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", + sys_vgui(".x%lx.c itemconfigure %lxRCOVER -fill #%6.6x -stroke #%6.6x\n .x%lx.c itemconfigure %lxPLED -strokewidth %d\n .x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol, x->x_gui.x_bcol, canvas, x, x->x_led_size, canvas, x, x->x_gui.x_bcol); /* @@ -410,12 +410,12 @@ static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", canvas, xpos, ypos + x->x_gui.x_h+3, xpos + IOWIDTH, ypos + x->x_gui.x_h+4, x, nlet_tag, 0, nlet_tag, 0, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%so%d %so%d %lxVU %lx outlet}\n", canvas, xpos+x->x_gui.x_w+2-IOWIDTH, ypos + x->x_gui.x_h+3, xpos+x->x_gui.x_w+2, ypos + x->x_gui.x_h+4, @@ -428,12 +428,12 @@ static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) } if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx outlet}\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx outlet}\n", + sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxVU%si%d %si%d %lxVU %lx outlet}\n", canvas, xpos+x->x_gui.x_w+2-IOWIDTH, ypos, xpos+x->x_gui.x_w+2, ypos+1, @@ -462,7 +462,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist) // if so, disable highlighting if (x->x_gui.x_glist == glist_getcanvas(glist)) { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x); for(i=1; i<=IEM_VU_STEPS; i++) { if(((i+2)&3) && (x->x_scale)) @@ -525,7 +525,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist) else { sys_vgui(".x%lx.c dtag %lxVU selected\n", canvas, x); - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); for(i=1; i<=IEM_VU_STEPS; i++) { if(((i+2)&3) && (x->x_scale)) @@ -610,8 +610,8 @@ static void vu__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo if (glist_isvisible(x->x_gui.x_glist)) { sys_vgui("lower %s\n", sh->h_pathname); - sys_vgui(".x%x.c create rectangle %d %d %d %d\ - -outline $select_color -width 1 -tags %s\n", + sys_vgui(".x%x.c create prect %d %d %d %d\ + -stroke $select_color -strokewidth 1 -tags %s\n", x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix, x->x_gui.x_obj.te_xpix + x->x_gui.x_w + 2, x->x_gui.x_obj.te_ypix + x->x_gui.x_h + 4, sh->h_outlinetag); diff --git a/pd/src/pd.tk b/pd/src/pd.tk index 079d87f76a057e1b78b3b10f34b5d3e66036f9c1..0cfd775eced0b7e57b2134b342b220daba6cd8c8 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -206,6 +206,7 @@ if { $tcl_platform(platform) == "windows" } { set cursor_editmode_disconnect "X_cursor" set cursor_editmode_resize "sb_h_double_arrow" set cursor_editmode_resize_bottom_right "bottom_right_corner" + set cursor_scroll "fleur" # set file types that open/save recognize set filetypes { {{Pd Files} {.pd} } @@ -234,6 +235,7 @@ if { $tcl_platform(platform) == "windows" } { set cursor_editmode_disconnect "X_cursor" set cursor_editmode_resize "sb_h_double_arrow" set cursor_editmode_resize_bottom_right "bottom_right_corner" + set cursor_scroll "fleur" # set file types that open/save recognize set filetypes { {{Pd Files} {.pd} } @@ -268,6 +270,7 @@ if { $tcl_platform(platform) == "windows" } { set cursor_editmode_disconnect "X_cursor" set cursor_editmode_resize "sb_h_double_arrow" set cursor_editmode_resize_bottom_right "bottom_right_corner" + set cursor_scroll "fleur" # set file types that open/save recognize set filetypes { {{pd files} {.pd} } @@ -279,9 +282,9 @@ if { $tcl_platform(platform) == "windows" } { set externalsdir "$::env(HOME)/pd-l2ork-externals" } -proc bgerror {message} { - pdtk_post "\ntcl error: $message" -} +#proc bgerror {message} { +# pdtk_post "\ntcl error: $message" +#} # make sure the user folder for installing externals exists catch { @@ -352,7 +355,7 @@ proc pdtk_enable_k12_mode {extra_dir} { global highlight_width set k12_mode 1 - set signal_cord_width 4 + set signal_cord_width 5 set autotips 1 set signal_cord_highlight "#474" set signal_cord "#2ca7d4" @@ -538,7 +541,7 @@ set obj_box_fill "#f6f8f8" set signal_cord_highlight "#58a" set signal_cord "#808095" set signal_nlet $signal_cord -set signal_cord_width 2 +set signal_cord_width 3 set msg_cord_highlight "#474" set msg_cord "#565" set msg_nlet "white" @@ -547,7 +550,7 @@ set msg_cord_width 1 #nlet highlighting stuff set select_nlet_color $select_color -set highlight_width 3 +set highlight_width 5 if {$pd_nt == 1} { global pd_guidir @@ -2322,6 +2325,8 @@ proc pdtk_k12_show_sound_icons {name} { } } +package require tkpath + ############# pdtk_canvas_new -- create a new canvas ############### proc pdtk_canvas_new {name width height geometry editable} { global pd_tearoff put_tearoff @@ -2723,7 +2728,7 @@ proc pdtk_canvas_new {name width height geometry editable} { pack $name.k12frame.edit $name.k12frame.datasound $name.k12frame.wii $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other -side top -expand 0 -fill x } - canvas $name.c -width $width -height $height -background $::canvas_color($name) \ + tkp::canvas $name.c -width $width -height $height -background $::canvas_color($name) \ -highlightthickness 0 -bd 0 \ -yscrollcommand "$name.scrollvert set" \ -xscrollcommand "$name.scrollhort set" \ @@ -3185,10 +3190,7 @@ proc pdtk_canvas_new {name width height geometry editable} { } #on linux, button 2 "pastes" from the X windows clipboard if {$pd_nt == 0} { - bind $name.c <Button-2> {\ - pdtk_canvas_click %W %x %y %b 0;\ - pdtk_canvas_mouseup %W %x %y %b;\ - pdtk_pastetext} + bind $name.c <Button-2> {pdtk_canvas_middleclick %W %x %y %b 0;} } bind $name.c <ButtonRelease> {pdtk_canvas_mouseup %W %x %y %b} @@ -3262,6 +3264,156 @@ proc pdtk_canvas_new {name width height geometry editable} { if { $k12_mode == 1 && $k12_saveas_on_new == 1 } { after 1000 [concat pdtk_k12_saveas_on_new $name] } + + set ::scroll_on($name) 0 + set ::last_scroll_x($name) 0 + set ::last_scroll_y($name) 0 +} + +set HSCROLL_PAD_L 6 +set HSCROLL_PAD_R 13 +set VSCROLL_PAD_U 6 +set VSCROLL_PAD_D 13 +set SCROLL_PAD_EDGE 5 +set SCROLL_THICKNESS 5 +set scrollbar_color "#555" +set hit_scrollbar 0 + +proc pdtk_canvas_draw_scrollbars {name} { + global scrollbar_color + global HSCROLL_PAD_L + global HSCROLL_PAD_R + global VSCROLL_PAD_U + global VSCROLL_PAD_D + global SCROLL_PAD_EDGE + global SCROLL_THICKNESS + set name [string trimright $name .c] + catch { + $name.c delete hscrollbar($name) + $name.c delete vscrollbar($name) + } + if {$::xscrollable($name)} { + set visible [$name.c xview] + set vx1 [lindex $visible 0] + set vx2 [lindex $visible 1] + set npix [expr int([winfo width $name]-$HSCROLL_PAD_L-$HSCROLL_PAD_R)] + set width [expr int($npix * ($vx2 -$vx1))] + set loffset [expr int($vx1 * $npix)] + set scrollx1 [expr [$name.c canvasx 0] + $HSCROLL_PAD_L + $loffset] + set scrolly1 [expr [$name.c canvasy 0] + [winfo height $name] - $SCROLL_PAD_EDGE] + set scrollx2 [expr $scrollx1 + $width] + #puts stderr "$vx1 $vx2 $npix $width $loffset $scrollx1 $scrollx2" + set hscroll [$name.c create polyline $scrollx1 $scrolly1 $scrollx2 $scrolly1 -stroke $scrollbar_color -strokewidth $SCROLL_THICKNESS -strokeopacity 0.25 -tags hscrollbar($name) -strokelinecap round] + $name.c bind $hscroll <Button-1> {pdtk_canvas_scroll_horizontal_click %W %x %y %b 0} + } + + if {$::yscrollable($name)} { + set visible [$name.c yview] + set vy1 [lindex $visible 0] + set vy2 [lindex $visible 1] + set npix [expr int([winfo height $name]-$VSCROLL_PAD_U-$VSCROLL_PAD_D)] + set height [expr int($npix * ($vy2 -$vy1))] + set toffset [expr int($vy1 * $npix)] + set scrollx1 [expr [$name.c canvasx 0] + [winfo width $name] - $SCROLL_PAD_EDGE] + set scrolly1 [expr [$name.c canvasy 0] + $VSCROLL_PAD_U +$toffset] + set scrolly2 [expr $scrolly1 + $height] + #puts stderr "$vy1 $vy2 $npix $height $toffset $scrolly1 $scrolly2" + set vscroll [$name.c create polyline $scrollx1 $scrolly1 $scrollx1 $scrolly2 -stroke $scrollbar_color -strokewidth $SCROLL_THICKNESS -strokeopacity 0.25 -tags vscrollbar($name) -strokelinecap round] + $name.c bind $vscroll <Button-1> {pdtk_canvas_scroll_vertical_click %W %x %y %b 0} + } + pdtk_canvas_update_sticky_tip $name.c +} + +# from c +proc pdtk_canvas_scroll_xy_click {name x y b} { + set ::scroll_on($name) $b + #set ::last_scroll_x($name) $x + #set ::last_scroll_y($name) $y + #puts stderr "XY CLICK $name $x $y" +} + +proc pdtk_canvas_scroll_horizontal_click {name x y b mod} { + global hit_scrollbar + #puts stderr "HORIZONTAL CLICK $name $x $y $b $mod" + set name [string trimright $name .c] + if { $b == 1 } { + set ::scroll_on($name) 1 + set hit_scrollbar 1 + } else { + set ::scroll_on($name) 0 + set hit_scrollbar 0 + } + #puts stderr $::scroll_on($name) + set ::last_scroll_x($name) $x +} + +#scroll_on states: +#0 = no scrolling +#1 = horizontal +#2 = vertical +#3 = both (middle click) + +proc pdtk_canvas_scroll_horizontal_motion {name x y mod} { + #puts stderr "HORIZONTAL MOTION $name $x $y $mod" + set name [string trimright $name .c] + if {$::xscrollable($name) && ($::scroll_on($name) == 1 || $::scroll_on($name) == 3)} { + set deltax [expr $::last_scroll_x($name) - $x] + #puts stderr "deltax=$deltax" + if { $deltax != 0 } { + set visible [$name.c xview] + set vx1 [lindex $visible 0] + set vx2 [lindex $visible 1] + set perpixdelta [expr ($vx2 - $vx1)/[winfo width $name]] + #puts stderr "scrolling... $vx1 $vx2 $perpixdelta" + #$name xview scroll [expr -$deltax] units + set displace [expr $perpixdelta*$deltax] + if {$::scroll_on($name) == 3} { + set displace [expr -$displace] + } + $name.c xview moveto [expr $vx1 - $displace] + pdtk_canvas_draw_scrollbars $name + } + } + set ::last_scroll_x($name) $x +} + +proc pdtk_canvas_scroll_vertical_click {name x y b mod} { + #puts stderr "VERTICAL CLICK $name $x $y $b $mod" + global hit_scrollbar + set name [string trimright $name .c] + if { $b == 1 } { + set ::scroll_on($name) 2 + set hit_scrollbar 1 + } else { + set ::scroll_on($name) 0 + set hit_scrollbar 0 + } + #puts stderr $::scroll_on($name) + set ::last_scroll_y($name) $y +} + +proc pdtk_canvas_scroll_vertical_motion {name x y mod} { + #puts stderr "VERTICAL MOTION $name $x $y $mod" + set name [string trimright $name .c] + if {$::yscrollable($name) && $::scroll_on($name) >= 2} { + set deltay [expr $::last_scroll_y($name) - $y] + #puts stderr "deltay=$deltay" + if { $deltay != 0 } { + set visible [$name.c yview] + set vy1 [lindex $visible 0] + set vy2 [lindex $visible 1] + set perpixdelta [expr ($vy2 - $vy1)/[winfo height $name]] + #puts stderr "scrolling... $vx1 $vx2 $perpixdelta" + #$name xview scroll [expr -$deltax] units + set displace [expr $perpixdelta*$deltay] + if {$::scroll_on($name) == 3} { + set displace [expr -$displace] + } + $name.c yview moveto [expr $vy1 - $displace] + pdtk_canvas_draw_scrollbars $name + } + } + set ::last_scroll_y($name) $y } proc pdtk_k12_saveas_on_new {name} { @@ -3618,9 +3770,21 @@ proc pdtk_canvas_sendclick {name x y b f} { pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b $f \; } +proc pdtk_canvas_sendmiddleclick {name x y b f} { + pd [canvastosym $name] mouse-2 [$name canvasx $x] [$name canvasy $y] $b $f \; +} + proc pdtk_canvas_click {name x y b f} { + global hit_scrollbar focus $name - pdtk_canvas_sendclick $name $x $y $b $f + if {$hit_scrollbar == 0} { + pdtk_canvas_sendclick $name $x $y $b $f + } +} + +proc pdtk_canvas_middleclick {name x y b f} { + focus $name + pdtk_canvas_sendmiddleclick $name $x $y $b $f } proc pdtk_canvas_rightclick {name x y b} { @@ -3652,6 +3816,8 @@ set pdtk_canvas_mouseup_ymaxval 0 proc pdtk_canvas_mouseup {name x y b} { pd [concat [canvastosym $name] mouseup [$name canvasx $x] \ [$name canvasy $y] $b \;] + pdtk_canvas_scroll_horizontal_click $name $x $y 0 0 + pdtk_canvas_scroll_vertical_click $name $x $y 0 0 } #proc pdtk_canvas_getscroll_ping {name} { @@ -3684,6 +3850,48 @@ proc pdtk_select_all_gop_widgets {name gop state} { } } +proc pdtk_find_lowest_widget_withtag {canvas name} { + #puts stderr "...pdtk_find_lowest_widget_withtag $canvas $name" + set ::arrange_lowest 0 + foreach item [$canvas find all] { + #puts stderr "tags=[$canvas gettags $item]" + foreach tag [$canvas gettags $item] { + if { [string first $name $tag] > -1 } { + #puts stderr ...match + set ::arrange_lowest $tag + break; + } + } + if { $::arrange_lowest != 0 } { + break; + } + } + #puts stderr "final_lowest=$tag" +} + +proc pdtk_find_highest_widget_withtag {canvas name} { + #puts stderr "pdtk_find_highest_widget_withtag $canvas $name" + set ::arrange_highest 0 + set interrupt 0 + foreach item [$canvas find all] { + #puts stderr "tags=[$canvas gettags $item]" + foreach tag [$canvas gettags $item] { + if { [string first $name $tag] > -1 } { + #puts stderr ...match + set ::arrange_highest $tag + break; + } elseif { $::arrange_highest != 0 } { + set interrupt 1 + break; + } + } + if { $interrupt == 1 } { + break; + } + } + #puts stderr "final_highest=$tag" +} + # currently unused proc pdtk_canvas_getscroll_configure {canvas} { set window [string trimright $canvas .c] @@ -3818,12 +4026,15 @@ proc pdtk_canvas_getscroll {name} { } } default { - set coords [$name coords $item] - foreach {x y} $coords { - if { $x < $x1 } {set x1 $x} - if { $x > $x2 } {set x2 $x} - if { $y < $y1 } {set y1 $y} - if { $y > $y2 } {set y2 $y} + if { $item != 0 } { + set coords [$name bbox $item] + #puts stderr "$name $item $coords" + foreach {x y} $coords { + if { $x < $x1 } {set x1 $x} + if { $x > $x2 } {set x2 $x} + if { $y < $y1 } {set y1 $y} + if { $y > $y2 } {set y2 $y} + } } #set imgtags [$name gettags $item] #set imgtag [lindex $imgtags 0] @@ -3902,14 +4113,14 @@ proc pdtk_canvas_getscroll {name} { if {$winwidth < $canvaswidth && $::xscrollable($parentname) == 0} { #puts stderr "PUTTING HORIZONTAL" - pack $parentname.scrollhort -fill x \ - -side bottom -before $parentname.c + #pack $parentname.scrollhort -fill x \ + # -side bottom -before $parentname.c set ::xscrollable($parentname) 1 } if {$winheight < $canvasheight && $::yscrollable($parentname) == 0} { #puts stderr "PUTTING VERTICAL" - pack $parentname.scrollvert -fill y \ - -side right -before $parentname.c + #pack $parentname.scrollvert -fill y \ + # -side right -before $parentname.c set ::yscrollable($parentname) 1 } } @@ -3940,6 +4151,8 @@ proc pdtk_canvas_getscroll {name} { } set ::update_tick([winfo parent $name]) 1 pdtk_canvas_checkgeometry [canvastosym $name] + pdtk_canvas_draw_scrollbars $name + pdtk_canvas_update_sticky_tip $name #puts stderr "END top-left x:[$name canvasx 0] y:[$name canvasy 0]" #update (bad idea--all kinds of unpredictable problems) @@ -4194,6 +4407,7 @@ proc pdtk_canvas_ctrlkey {name key shift} { proc pdtk_canvas_scroll {canvas xy distance} { if {$xy eq "x" && $::xscrollable([winfo parent $canvas]) == 1 || $xy eq "y" && $::yscrollable([winfo parent $canvas]) == 1 } { $canvas [list $xy]view scroll $distance units + pdtk_canvas_draw_scrollbars $canvas } } @@ -4268,6 +4482,8 @@ proc pdtk_canvas_motion {name x y mods} { #puts stderr [concat $pointer_x_local $pointer_y_local $pointer_x_global $pointer_y_global] #puts stderr [concat [canvastosym $name] $name $x $y] pd [canvastosym $name] motion [$name canvasx $x] [$name canvasy $y] $mods \; + pdtk_canvas_scroll_horizontal_motion $name $x $y 0 + pdtk_canvas_scroll_vertical_motion $name $x $y 0 } # "map" event tells us when the canvas becomes visible (arg is "0") or @@ -5715,6 +5931,8 @@ proc array_apply {id canvas} { set saveit [eval concat $$var_array_saveit] set drawasrects [eval concat $$var_array_drawasrects] + #puts stderr "...[expr $saveit + 2 * $drawasrects]" + set xdraw [expr int([$canvas.c canvasx 0])] set ydraw [expr int([$canvas.c canvasy 0])] @@ -5802,12 +6020,12 @@ proc pdtk_array_dialog {id name n flags newone canvas} { match_linux_wm [list radiobutton $id.drawasrects.drawasrects1 -value 1 \ -variable $var_array_drawasrects \ -text "polygon"] - match_linux_wm [list radiobutton $id.drawasrects.drawasrects2 -value 2 \ - -variable $var_array_drawasrects \ - -text "bezier curve"] + #match_linux_wm [list radiobutton $id.drawasrects.drawasrects2 -value 2 \ + # -variable $var_array_drawasrects \ + # -text "bezier curve"] pack $id.drawasrects.drawasrects0 -side top pack $id.drawasrects.drawasrects1 -side top - pack $id.drawasrects.drawasrects2 -side top + #pack $id.drawasrects.drawasrects2 -side top if {$newone != 0} { match_linux_wm [list frame $id.radio] @@ -8203,6 +8421,34 @@ proc pdtk_canvas_enteritem {tkcanvas x y item enterid} { } } +# update sticky tooltip when scrolling +proc pdtk_canvas_update_sticky_tip {w} { + #puts stderr "update_sticky_tip $w [lsearch -exact [$w gettags $w.tipwindow] \"sticky\"] [winfo exists $w.tiplabel]" + #catch { + if {[winfo exists $w.tiplabel]} { + #puts stderr "got it" + #set yreal [expr [$w canvasy 0] * -1 + \ + # [winfo pointery $w]-[winfo rooty $w]] + set yoffset 0 + #if {$yreal < [expr [winfo height $w] - \ + # [winfo reqheight $w.tiplabel]] - 5} { + # set yoffset [winfo height $w] + # set anchor "sw" + #} else { + # set anchor "nw" + #} + if {[$w itemcget $w.tipwindow -anchor] == "sw"} { + set yoffset [winfo height $w] + } + set x [$w canvasx 0] + set y [expr [$w canvasy 0] + $yoffset] + $w coords $w.tipwindow $x $y + #$w itemconfigure $w.tipwindow -anchor $anchor + #puts stderr "[winfo pointery $w] [winfo rooty $w] $yreal $anchor" + } + #} +} + # move activewidth to toggle on editmode? proc pdtk_canvas_leaveitem {w} { variable afterid @@ -8273,7 +8519,7 @@ proc pdtk_tip {w fromc show args} { } if {$fromc == 1} { - set yreal [expr [$w canvasy 0] * -1 + \ + set yreal [expr [$w canvasy 0] + \ [winfo pointery $w]-[winfo rooty $w]] set yoffset 0 if {$yreal < [expr [winfo height $w] - \ @@ -8283,6 +8529,7 @@ proc pdtk_tip {w fromc show args} { } else { set anchor "nw" } + #puts stderr "$yreal [winfo height $w] [winfo reqheight $w.tiplabel]" set x [$w canvasx 0] set y [expr [$w canvasy 0] + $yoffset] } else { @@ -8363,7 +8610,7 @@ proc pdtk_tip {w fromc show args} { $w coords tiparrow [expr $xarrow+5] [expr $yreal+$yreal_offset] $xarrow $yarrow [expr $xarrow+10] $yarrow } else { #$w create polygon [expr $xreal+$xreal_offset] [expr $yreal+$yreal_offset] $xarrow $yarrow [expr $xarrow+10] $yarrow -fill $nlet_color -width 4 -tags tiparrow - $w create polygon [expr $xarrow+5] [expr $yreal+$yreal_offset] $xarrow $yarrow [expr $xarrow+10] $yarrow -fill $nlet_color -width 4 -tags tiparrow + $w create ppolygon [expr $xarrow+5] [expr $yreal+$yreal_offset] $xarrow $yarrow [expr $xarrow+10] $yarrow -stroke $nlet_color -fill $nlet_color -strokewidth 1 -tags tiparrow #update (bad idea--avoid this) } } @@ -8376,21 +8623,35 @@ proc pdtk_tip {w fromc show args} { $w coords $w.tipwindow $x $y $w itemconfigure $w.tipwindow -anchor $anchor } else { - $w create window $x $y -window $w.tiplabel -anchor $anchor \ - -tags $tags - $w bind $w.tipwindow <Enter> "pdtk_tip_mouseover $w" - #update + $w create window $x $y -window $w.tiplabel -anchor $anchor \ + -tags $tags + if {$fromc == 1} { + #$w bind $w.tiplabel <Enter> "pdtk_tip_mouseover $w" + bind $w.tiplabel <Motion> "pdtk_tip_mouseover $w" + #update -- bad idea, don't do it + } } } } +set ::tip_mouseover_ping 0 + # move the tip if the user happens to mouse over it proc pdtk_tip_mouseover {w} { + if {$::tip_mouseover_ping == 1} { return } #puts stderr "pdtk_tip_mouseover $w" - set msg [$w.tiplabel cget -text] - set sticky [expr [lsearch -exact [$w gettags $w.tipwindow] \ - "sticky"] != -1] - pdtk_tip $w $sticky 1 $msg + if {[$w itemcget $w.tipwindow -anchor] == "sw"} { + set yoffset 0 + set anchor "nw" + } else { + set yoffset [winfo height $w] + set anchor "sw" + } + set x [$w canvasx 0] + set y [expr [$w canvasy 0] + $yoffset] + $w coords $w.tipwindow $x $y + $w itemconfigure $w.tipwindow -anchor $anchor + after 50 {set ::tip_mouseover_ping 0} } proc pdtk_gettip { w item xletno name helpname dir } { diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c index 32102133aeb431d46839c2e958ab04fc7f25c35c..7737f9c0ca9898659aefbbd10ee82b8edc86f715 100644 --- a/pd/src/t_tkcmd.c +++ b/pd/src/t_tkcmd.c @@ -555,10 +555,10 @@ static int pdCmd(ClientData cd, Tcl_Interp *interp, int argc, char **argv) void tcl_mess(char *s) { int result; - char catch_s[strlen(s)+10]; - sprintf(catch_s, "catch { %s }", s); - //char catch_s[strlen(s)]; - //sprintf(catch_s, "%s", s); + //char catch_s[strlen(s)+10]; + //sprintf(catch_s, "catch { %s }", s); + char catch_s[strlen(s)]; + sprintf(catch_s, "%s", s); Tcl_Obj *messageObjPtr = Tcl_NewStringObj(catch_s,-1); Tcl_IncrRefCount(messageObjPtr); result = Tcl_EvalObjEx(tk_pdinterp, messageObjPtr, TCL_EVAL_GLOBAL);