diff options
-rw-r--r-- | cyclone/hammer/comment.c | 14 | ||||
-rw-r--r-- | shared/hammer/file.c | 18 | ||||
-rw-r--r-- | shared/hammer/gui.c | 32 | ||||
-rw-r--r-- | shared/toxy/scriptlet.c | 9 |
4 files changed, 44 insertions, 29 deletions
diff --git a/cyclone/hammer/comment.c b/cyclone/hammer/comment.c index 8fd2431..b10728d 100644 --- a/cyclone/hammer/comment.c +++ b/cyclone/hammer/comment.c @@ -247,11 +247,11 @@ static void comment__clickhook(t_comment *x, t_symbol *s, int ac, t_atom *av) char buf[COMMENT_OUTBUFSIZE], *outp = buf; int cvid = (int)x->x_canvas; sprintf(outp, ".x%x.c bind %s <ButtonRelease> \ - {pd [concat %s _release %s \\;]}\n", cvid, x->x_texttag, + {pdsend {%s _release %s}}\n", cvid, x->x_texttag, x->x_bindsym->s_name, x->x_bindsym->s_name); outp += strlen(outp); sprintf(outp, ".x%x.c bind %s <Motion> \ - {pd [concat %s _motion %s %%x %%y \\;]}\n", cvid, x->x_texttag, + {pdsend {%s _motion %s %%x %%y}}\n", cvid, x->x_texttag, x->x_bindsym->s_name, x->x_bindsym->s_name); outp += strlen(outp); sprintf(outp, ".x%x.c create rectangle %d %d %d %d -outline blue \ @@ -812,13 +812,17 @@ void comment_setup(void) gensym("_bbox"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + /* if older than 0.43, create an 0.43-style pdsend */ + sys_gui("if {[llength [info procs ::pdsend]] == 0} {"); + sys_gui("proc ::pdsend {args} {::pd \"[join $args { }] ;\"}}\n"); + sys_gui("proc comment_bbox {target cvname tag} {\n\ - pd $target _bbox $target [$cvname bbox $tag]\\;}\n"); + pdsend \"$target _bbox $target [$cvname bbox $tag]\"}\n"); /* LATER think about window vs canvas coords */ sys_gui("proc comment_click {target cvname x y tag} {\n\ - pd $target _click $target [$cvname canvasx $x] [$cvname canvasy $y]\ - [$cvname index $tag @$x,$y] [$cvname bbox $tag]\\;}\n"); + pdsend \"$target _click $target [$cvname canvasx $x] [$cvname canvasy $y]\ + [$cvname index $tag @$x,$y] [$cvname bbox $tag]\"}\n"); /* LATER think how to conditionally (FORKY_VERSION >= 38) replace puts with pdtk_post */ diff --git a/shared/hammer/file.c b/shared/hammer/file.c index eec3ad3..847d81f 100644 --- a/shared/hammer/file.c +++ b/shared/hammer/file.c @@ -60,6 +60,10 @@ static t_hammerfile *hammerfile_getproxy(t_pd *master) static void hammereditor_guidefs(void) { + /* if older than 0.43, create an 0.43-style pdsend */ + sys_gui("if {[llength [info procs ::pdsend]] == 0} {"); + sys_gui("proc ::pdsend {args} {::pd \"[join $args { }] ;\"}}\n"); + sys_gui("proc hammereditor_open {name geometry title sendable} {\n"); sys_gui(" if {[winfo exists $name]} {\n"); sys_gui(" $name.text delete 1.0 end\n"); @@ -111,7 +115,7 @@ static void hammereditor_guidefs(void) /* FIXME make it more reliable */ sys_gui("proc hammereditor_send {name} {\n"); sys_gui(" if {[winfo exists $name]} {\n"); - sys_gui(" pd [concat miXed$name clear \\;]\n"); + sys_gui(" pdsend \"miXed$name clear\"\n"); sys_gui(" for {set i 1} \\\n"); sys_gui(" {[$name.text compare $i.end < end]} \\\n"); sys_gui(" {incr i 1} {\n"); @@ -120,10 +124,10 @@ static void hammereditor_guidefs(void) /* LATER rethink semi/comma mapping */ sys_gui(" regsub -all \\; $lin \" _semi_ \" tmplin\n"); sys_gui(" regsub -all \\, $tmplin \" _comma_ \" lin\n"); - sys_gui(" pd [concat miXed$name addline $lin \\;]\n"); + sys_gui(" pdsend \"miXed$name addline $lin\"\n"); sys_gui(" }\n"); sys_gui(" }\n"); - sys_gui(" pd [concat miXed$name end \\;]\n"); + sys_gui(" pdsend \"miXed$name end\"\n"); sys_gui(" }\n"); sys_gui("}\n"); @@ -268,8 +272,8 @@ static void hammerpanel_guidefs(void) #if 1 sys_gui(" puts stderr [concat $directory]\n"); #endif - sys_gui(" pd [concat $target path \\\n"); - sys_gui(" [pdtk_enquote $filename] [pdtk_enquote $directory] \\;]\n"); + sys_gui(" pdsend \"$target path \\\n"); + sys_gui(" [pdtk_enquote $filename] [pdtk_enquote $directory] \"\n"); sys_gui(" }\n"); sys_gui("}\n"); @@ -284,8 +288,8 @@ static void hammerpanel_guidefs(void) sys_gui(" set directory [string range $filename 0 \\\n"); sys_gui(" [expr [string last / $filename ] - 1]]\n"); sys_gui(" if {$directory == \"\"} {set directory \"/\"}\n"); - sys_gui(" pd [concat $target path \\\n"); - sys_gui(" [pdtk_enquote $filename] [pdtk_enquote $directory] \\;]\n"); + sys_gui(" pdsend \"$target path \\\n"); + sys_gui(" [pdtk_enquote $filename] [pdtk_enquote $directory] \"\n"); sys_gui(" }\n"); sys_gui("}\n"); } diff --git a/shared/hammer/gui.c b/shared/hammer/gui.c index 104af3a..25ae78b 100644 --- a/shared/hammer/gui.c +++ b/shared/hammer/gui.c @@ -134,14 +134,14 @@ static void hammergui_dobindmouse(t_hammergui *snk) #if 0 /* How to be notified about changes of button state, prior to gui objects in a canvas? LATER find a reliable way -- delete if failed */ - sys_vgui("bind hammertag <<hammerdown>> {pd [concat %s _up 0 \\;]}\n", + sys_vgui("bind hammertag <<hammerdown>> {pdsend {%s _up 0}}\n", snk->g_psgui->s_name); - sys_vgui("bind hammertag <<hammerup>> {pd [concat %s _up 1 \\;]}\n", + sys_vgui("bind hammertag <<hammerup>> {pdsend {%s _up 1}}\n", snk->g_psgui->s_name); #endif - sys_vgui("bind all <<hammerdown>> {pd [concat %s _up 0 \\;]}\n", + sys_vgui("bind all <<hammerdown>> {pdsend {%s _up 0}}\n", snk->g_psgui->s_name); - sys_vgui("bind all <<hammerup>> {pd [concat %s _up 1 \\;]}\n", + sys_vgui("bind all <<hammerup>> {pdsend {%s _up 1}}\n", snk->g_psgui->s_name); } @@ -167,10 +167,10 @@ static void hammergui_dobindfocus(t_hammergui *snk) { sys_vgui("bind Canvas <<hammerfocusin>> \ {if {[hammergui_ispatcher %%W]} \ - {pd [concat %s _focus %%W 1 \\;]}}\n", snk->g_psgui->s_name); + {pdsend {%s _focus %%W 1}}}\n", snk->g_psgui->s_name); sys_vgui("bind Canvas <<hammerfocusout>> \ {if {[hammergui_ispatcher %%W]} \ - {pd [concat %s _focus %%W 0 \\;]}}\n", snk->g_psgui->s_name); + {pdsend {%s _focus %%W 0}}}\n", snk->g_psgui->s_name); } static void hammergui__refocus(t_hammergui *snk) @@ -198,10 +198,10 @@ static void hammergui_dobindvised(t_hammergui *snk) #endif sys_vgui("bind Canvas <<hammervised>> \ {if {[hammergui_ispatcher %%W]} \ - {pd [concat %s _vised %%W 1 \\;]}}\n", snk->g_psgui->s_name); + {pdsend {%s _vised %%W 1}}}\n", snk->g_psgui->s_name); sys_vgui("bind Canvas <<hammerunvised>> \ {if {[hammergui_ispatcher %%W]} \ - {pd [concat %s _vised %%W 0 \\;]}}\n", snk->g_psgui->s_name); + {pdsend {%s _vised %%W 0}}}\n", snk->g_psgui->s_name); } static void hammergui__revised(t_hammergui *snk) @@ -268,9 +268,13 @@ static int hammergui_setup(void) class_addmethod(hammergui_class, (t_method)hammergui__vised, ps__vised, A_SYMBOL, A_FLOAT, 0); + /* if older than 0.43, create an 0.43-style pdsend */ + sys_gui("if {[llength [info procs ::pdsend]] == 0} {"); + sys_gui("proc ::pdsend {args} {::pd \"[join $args { }] ;\"}}\n"); + /* Protect against pdCmd being called (via "Canvas <Destroy>" binding) during Tcl_Finalize(). FIXME this should be a standard exit handler. */ - sys_gui("proc hammergui_exithook {cmd op} {proc pd {} {}}\n"); + sys_gui("proc hammergui_exithook {cmd op} {proc ::pdsend {} {}}\n"); sys_gui("if {[info tclversion] >= 8.4} {\n\ trace add execution exit enter hammergui_exithook}\n"); @@ -283,13 +287,13 @@ static int hammergui_setup(void) sys_gui("proc hammergui_remouse {} {\n"); sys_gui(" bind all <<hammerdown>> {}\n"); sys_gui(" bind all <<hammerup>> {}\n"); - sys_gui(" pd [concat #hammergui _remouse \\;]\n"); + sys_gui(" pdsend {#hammergui _remouse}\n"); sys_gui("}\n"); sys_gui("proc hammergui_mousexy {target} {\n"); sys_gui(" set x [winfo pointerx .]\n"); sys_gui(" set y [winfo pointery .]\n"); - sys_gui(" pd [concat #hammermouse $target $x $y \\;]\n"); + sys_gui(" pdsend \"#hammermouse $target $x $y\"\n"); sys_gui("}\n"); /* visibility hack for msw, LATER rethink */ @@ -308,7 +312,7 @@ static int hammergui_setup(void) sys_gui(" set x [winfo pointerx .]\n"); sys_gui(" set y [winfo pointery .]\n"); sys_gui(" if {$hammergui_x != $x || $hammergui_y != $y} {\n"); - sys_gui(" pd [concat #hammermouse _poll $x $y \\;]\n"); + sys_gui(" pdsend \"#hammermouse _poll $x $y\"\n"); sys_gui(" set hammergui_x $x\n"); sys_gui(" set hammergui_y $y\n"); sys_gui(" }\n"); @@ -319,13 +323,13 @@ static int hammergui_setup(void) sys_gui("proc hammergui_refocus {} {\n"); sys_gui(" bind Canvas <<hammerfocusin>> {}\n"); sys_gui(" bind Canvas <<hammerfocusout>> {}\n"); - sys_gui(" pd [concat #hammergui _refocus \\;]\n"); + sys_gui(" pdsend {#hammergui _refocus}\n"); sys_gui("}\n"); sys_gui("proc hammergui_revised {} {\n"); sys_gui(" bind Canvas <<hammervised>> {}\n"); sys_gui(" bind Canvas <<hammerunvised>> {}\n"); - sys_gui(" pd [concat #hammergui _revised \\;]\n"); + sys_gui(" pdsend {#hammergui _revised}\n"); sys_gui("}\n"); return (1); } diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c index 42e3c02..db836ab 100644 --- a/shared/toxy/scriptlet.c +++ b/shared/toxy/scriptlet.c @@ -380,17 +380,17 @@ static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, { if (ibuf[1] == ':') { - sprintf(obuf, "{pd [concat "); + sprintf(obuf, "{pdsend [concat "); len = 2; } else if (ibuf[1] == '|') { - sprintf(obuf, "{pd [concat %s ", sp->s_rptarget->s_name); + sprintf(obuf, "{pdsend [concat %s ", sp->s_rptarget->s_name); len = 2; } else { - sprintf(obuf, "{pd [concat %s _cb ", sp->s_cbtarget->s_name); + sprintf(obuf, "{pdsend [concat %s _cb ", sp->s_cbtarget->s_name); len = 1; } } @@ -1064,6 +1064,9 @@ t_scriptlet *scriptlet_new(t_pd *owner, sys_gui(" pd [concat $target _rp $::toxy::reply \\;]\n"); sys_gui(" unset ::toxy::reply\n"); sys_gui("}\n"); + /* if older than 0.43, create an 0.43-style pdsend */ + sys_gui("if {[llength [info procs ::pdsend]] == 0} {"); + sys_gui("proc ::pdsend {args} {::pd \"[join $args { }] ;\"}}\n"); configured = 1; } sp->s_owner = owner; |