From 2005cba607270a0e176d739361cb6327fab061f7 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Wed, 26 Jul 2006 17:01:23 +0000 Subject: fixed coordinates for GOP svn path=/trunk/externals/unauthorized/; revision=5416 --- scratcher~/CHANGES.LOG | 2 ++ scratcher~/help-scratcher~.pd | 7 ++++++ scratcher~/scratcher~.c | 24 ++++++------------ scratcher~/scratcher~.tk2c | 58 +++++++++++++++++++++++++++++++++++++++++++ scratcher~/tk2c.bash | 24 ++++++++++++++++++ 5 files changed, 98 insertions(+), 17 deletions(-) create mode 100644 scratcher~/help-scratcher~.pd create mode 100755 scratcher~/scratcher~.tk2c create mode 100755 scratcher~/tk2c.bash (limited to 'scratcher~') diff --git a/scratcher~/CHANGES.LOG b/scratcher~/CHANGES.LOG index 31e90d9..f53e163 100644 --- a/scratcher~/CHANGES.LOG +++ b/scratcher~/CHANGES.LOG @@ -1,3 +1,5 @@ +0.10 + fixed coordinates for GOP support 0.9 added GOP support 0.8 diff --git a/scratcher~/help-scratcher~.pd b/scratcher~/help-scratcher~.pd new file mode 100644 index 0000000..4a9149c --- /dev/null +++ b/scratcher~/help-scratcher~.pd @@ -0,0 +1,7 @@ +#N canvas 0 0 450 300 10; +#X obj 174 121 rs-scratcher~; +#X text 201 77 Playing with the block size \,; +#X text 201 87 so everything's in the subpatch; +#X obj 171 160 dac~; +#X connect 0 0 3 0; +#X connect 0 0 3 1; diff --git a/scratcher~/scratcher~.c b/scratcher~/scratcher~.c index bd970a7..d5a950e 100644 --- a/scratcher~/scratcher~.c +++ b/scratcher~/scratcher~.c @@ -37,28 +37,18 @@ #include #include #include - -#ifdef __APPLE__ -#include -#else #include -#endif - #include #include #include #include -#ifdef _WIN32 -#include -#include "timeval.h" -#else +#ifdef UNIX #include -#endif /* _WIN32 */ -#include - -#ifndef M_PI +#endif +#ifdef NT #define M_PI 3.14159265358979323846 -#endif /* not M_PI */ +#endif +#include #include "m_pd.h" #include "m_imp.h" @@ -120,7 +110,7 @@ static int ignorevisible=1; // ignore visible test #define SCRATCHER_NB_GROOVES 20 #define SCRATCHER_MOVE_TIMEOUT 20 -static char *scratcher_version = "scratcher~: version 0.9, written by Yves Degoyon (ydegoyon@free.fr)"; +static char *scratcher_version = "scratcher~: version 0.10, written by Yves Degoyon (ydegoyon@free.fr)"; static t_class *scratcher_class; t_widgetbehavior scratcher_widgetbehavior; @@ -288,7 +278,7 @@ static void scratcher_save(t_gobj *z, t_binbuf *b) t_scratcher *x = (t_scratcher *)z; binbuf_addv(b, "ssiisiiiiff", gensym("#X"),gensym("obj"), - (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist), + (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix, gensym("scratcher~"), x->x_size, x->x_width, x->x_height, x->x_sensibility, x->x_maxspeed, x->x_inertia ); binbuf_addv(b, ";"); diff --git a/scratcher~/scratcher~.tk2c b/scratcher~/scratcher~.tk2c new file mode 100755 index 0000000..8c07523 --- /dev/null +++ b/scratcher~/scratcher~.tk2c @@ -0,0 +1,58 @@ +// ########### scratcher procedures -- ydegoyon@free.fr ######### +sys_gui("proc scratcher_apply {id} {\n"); +// strip "." from the TK id to make a variable name suffix +sys_gui("set vid [string trimleft $id .]\n"); +// for each variable, make a local variable to hold its name... +sys_gui("set var_graph_width [concat graph_width_$vid]\n"); +sys_gui("global $var_graph_width\n"); +sys_gui("set var_graph_height [concat graph_height_$vid]\n"); +sys_gui("global $var_graph_height\n"); +sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] \\;]\n"); +// puts stderr $cmd +sys_gui("pd $cmd\n"); +sys_gui("}\n"); +sys_gui("proc scratcher_cancel {id} {\n"); +sys_gui("set cmd [concat $id cancel \\;]\n"); +// puts stderr $cmd +sys_gui("pd $cmd\n"); +sys_gui("}\n"); +sys_gui("proc scratcher_ok {id} {\n"); +sys_gui("scratcher_apply $id\n"); +sys_gui("scratcher_cancel $id\n"); +sys_gui("}\n"); +sys_gui("proc pdtk_scratcher_dialog {id width height} {\n"); +sys_gui("set vid [string trimleft $id .]\n"); +sys_gui("set var_graph_width [concat graph_width_$vid]\n"); +sys_gui("global $var_graph_width\n"); +sys_gui("set var_graph_height [concat graph_height_$vid]\n"); +sys_gui("global $var_graph_height\n"); +sys_gui("set $var_graph_width $width\n"); +sys_gui("set $var_graph_height $height\n"); +sys_gui("toplevel $id\n"); +sys_gui("wm title $id {scratcher}\n"); +sys_gui("wm protocol $id WM_DELETE_WINDOW [concat scratcher_cancel $id]\n"); +sys_gui("label $id.label -text {SCRATCHER PROPERTIES}\n"); +sys_gui("pack $id.label -side top\n"); +sys_gui("frame $id.buttonframe\n"); +sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n"); +sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"scratcher_cancel $id\"\n"); +sys_gui("button $id.buttonframe.apply -text {Apply} -command \"scratcher_apply $id\"\n"); +sys_gui("button $id.buttonframe.ok -text {OK} -command \"scratcher_ok $id\"\n"); +sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n"); +sys_gui("pack $id.buttonframe.apply -side left -expand 1\n"); +sys_gui("pack $id.buttonframe.ok -side left -expand 1\n"); +sys_gui("frame $id.1rangef\n"); +sys_gui("pack $id.1rangef -side top\n"); +sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n"); +sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n"); +sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n"); +sys_gui("frame $id.2rangef\n"); +sys_gui("pack $id.2rangef -side top\n"); +sys_gui("label $id.2rangef.lheight -text \"Height :\"\n"); +sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n"); +sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n"); +sys_gui("bind $id.1rangef.name [concat scratcher_ok $id]\n"); +sys_gui("bind $id.2rangef.height [concat scratcher_ok $id]\n"); +sys_gui("focus $id.1rangef.name\n"); +sys_gui("}\n"); +// ########### scratcher procedures END -- ydegoyon@free.fr ######### diff --git a/scratcher~/tk2c.bash b/scratcher~/tk2c.bash new file mode 100755 index 0000000..9dfeb03 --- /dev/null +++ b/scratcher~/tk2c.bash @@ -0,0 +1,24 @@ +#!/bin/bash + +#set -x + +while read line +do + for word in $line + do + if [ "X"$word != "X"${word#\#} ] + then + echo // ${line#\#} + break + else + line=${line//\'/\\\'} +#useless, slashes never gets in + line=${line//\\/\\\\} +#this one's dirty, i know + line=${line//;/\\\\;} + line=${line//\"/\\\"} + echo 'sys_gui("'$line'\n");' + break + fi + done +done -- cgit v1.2.1