diff options
author | Thomas O Fredericks <mrtof@users.sourceforge.net> | 2007-10-04 16:28:30 +0000 |
---|---|---|
committer | Thomas O Fredericks <mrtof@users.sourceforge.net> | 2007-10-04 16:28:30 +0000 |
commit | 0cb89848b7d2be4b1d0021823d2707b855891ea0 (patch) | |
tree | 300260706cd678a41c3de9f6dd7a4088faab6dd7 | |
parent | 31f625c4e5eaf443872eece61b9a7156121669d9 (diff) |
Changing directory structure for externals/tof
svn path=/trunk/externals/tof/; revision=8783
-rw-r--r-- | src/destroysend.c | 50 | ||||
-rw-r--r-- | src/folderpanel.c | 89 | ||||
-rwxr-xr-x | src/getdollarzero.c | 64 |
3 files changed, 203 insertions, 0 deletions
diff --git a/src/destroysend.c b/src/destroysend.c new file mode 100644 index 0000000..fbf3466 --- /dev/null +++ b/src/destroysend.c @@ -0,0 +1,50 @@ +// Made by tof@danslchamp.prg + +#include "m_pd.h" +#include <string.h> +#include <stdio.h> + +static t_class *destroysend_class; + +typedef struct _destroysend { + t_object x_obj; + t_symbol *x_sym; //from pd_send +} t_destroysend; + +void destroysend_bang(t_destroysend *x) +{ + //post("Hello world !!"); +//From pd_send + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); +//END +} + + +void *destroysend_new(t_symbol *s) //Added args from pd send +{ + t_destroysend *x = (t_destroysend *)pd_new(destroysend_class); + +//From pd_send + + if (!*s->s_name) symbolinlet_new(&x->x_obj, &x->x_sym); + x->x_sym = s; + +//END + + return (void *)x; //return (x); +} + + +void *destroysend_free(t_destroysend *x)
+{ + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing);
+ //post("Killing !!");
+ return 0;
+} + +void destroysend_setup(void) { + + destroysend_class = class_new(gensym("destroysend"),(t_newmethod)destroysend_new,(t_method)destroysend_free, +sizeof(t_destroysend),0, A_DEFSYM, 0); + class_addbang(destroysend_class, destroysend_bang); +} diff --git a/src/folderpanel.c b/src/folderpanel.c new file mode 100644 index 0000000..51d735b --- /dev/null +++ b/src/folderpanel.c @@ -0,0 +1,89 @@ +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" + +// tk_chooseDirectory +/* + +proc pdtk_folderpanel {target localdir} { + if {$localdir == ""} { + set filename [tk_getSaveFile] + } else { + set filename [tk_getSaveFile -initialdir $localdir] + } + if {$filename != ""} { + pd [concat $target callback [pdtk_enquote $filename] \;] + } +} + + +*/ + + + + +t_class *folderpanel_class; + +typedef struct _folderpanel +{ + t_object x_obj; + t_symbol *x_s; +} t_folderpanel; + + +static void folderpanel_symbol(t_folderpanel *x, t_symbol *s) +{ + char *path = (s && s->s_name) ? s->s_name : "\"\""; + sys_vgui("tof_folderpanel %s \n", x->x_s->s_name); +} + +static void folderpanel_bang(t_folderpanel *x) +{ + folderpanel_symbol(x, &s_); +} + +static void folderpanel_callback(t_folderpanel *x, t_symbol *s) +{ + outlet_symbol(x->x_obj.ob_outlet, s); +} + +static void folderpanel_free(t_folderpanel *x) +{ + pd_unbind(&x->x_obj.ob_pd, x->x_s); +} + +static void *folderpanel_new( void) +{ + char buf[50]; + t_folderpanel *x = (t_folderpanel *)pd_new(folderpanel_class); + sprintf(buf, "d%lx", (t_int)x); + x->x_s = gensym(buf); + pd_bind(&x->x_obj.ob_pd, x->x_s); + outlet_new(&x->x_obj, &s_symbol); + return (x); +} + +void folderpanel_setup(void) +{ + folderpanel_class = class_new(gensym("folderpanel"), + (t_newmethod)folderpanel_new, (t_method)folderpanel_free, + sizeof(t_folderpanel), 0, 0); + class_addbang(folderpanel_class, folderpanel_bang); + class_addsymbol(folderpanel_class, folderpanel_symbol); + class_addmethod(folderpanel_class, (t_method)folderpanel_callback, + gensym("callback"), A_SYMBOL, 0); + + + sys_gui("proc tof_folderpanel {target} {\n"); + sys_gui(" set path [tk_chooseDirectory] \n"); + sys_gui(" if {$path != \"\"} {\n"); + sys_gui(" pd [concat $target callback [pdtk_enquote $path]] \\;\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + + +} + + diff --git a/src/getdollarzero.c b/src/getdollarzero.c new file mode 100755 index 0000000..8a19486 --- /dev/null +++ b/src/getdollarzero.c @@ -0,0 +1,64 @@ +/* (C) 2005 Guenter Geiger */ + +#include "m_pd.h" +#include "g_canvas.h" + + +/* HACK + +struct _glist +{ + t_object gl_obj; // header in case we're a glist + t_gobj *gl_list; // the actual data + struct _gstub *gl_stub; // safe pointer handler + int gl_valid; // incremented when pointers might be stale + struct _glist *gl_owner; // parent glist, supercanvas, or 0 if none +}; + +END HACK + +*/ + +typedef struct getdollarzero +{ + t_object x_ob; + t_canvas * x_canvas; + t_outlet* x_outlet; + int x_level; +} t_getdollarzero; + + + + +static void getdollarzero_bang(t_getdollarzero *x) +{ + int i = x->x_level; + t_canvas* last = x->x_canvas; + + while (i>0) { + i--; + if (last->gl_owner) last = last->gl_owner; + } +// x->s_parent_unique = canvas_realizedollar((t_canvas *)this_canvas->gl_owner, gensym("$0")); + //outlet_symbol(x->x_outlet,canvas_getdir(last)); + outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym("$0"))); +} + +t_class *getdollarzero_class; + +static void *getdollarzero_new(t_floatarg level) +{ + t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class); + x->x_canvas = canvas_getcurrent(); + x->x_outlet = outlet_new(&x->x_ob, &s_); + x->x_level = level; + return (void *)x; +} + +void getdollarzero_setup(void) +{ + getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, + sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); + class_addbang(getdollarzero_class, getdollarzero_bang); +} + |