aboutsummaryrefslogtreecommitdiff
path: root/shared/hammer
diff options
context:
space:
mode:
Diffstat (limited to 'shared/hammer')
-rw-r--r--shared/hammer/file.c18
-rw-r--r--shared/hammer/gui.c32
2 files changed, 29 insertions, 21 deletions
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);
}