From 5f9f3ed9b7c2ff07d8745c81d1a085c8eaa08737 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 30 Jul 2005 12:21:41 +0000 Subject: added flext_base::GetCanvasDir to retrieve folder where patcher resides renamed flext_base::CanvasArgs to GetCanvasArgs fixed flext install routine for bcc makefile svn path=/trunk/; revision=3388 --- externals/grill/flext/source/flbase.cpp | 33 ++++++++++++++++++++++++++++++--- externals/grill/flext/source/flbase.h | 5 ++++- 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp index 2fd3fc97..63017d47 100644 --- a/externals/grill/flext/source/flbase.cpp +++ b/externals/grill/flext/source/flbase.cpp @@ -149,16 +149,43 @@ void canvas_getargs(int *argcp, t_atom **argvp); #endif -void flext_obj::CanvasArgs(AtomList &args) const +void flext_obj::GetCanvasArgs(AtomList &args) const { #if FLEXT_SYS == FLEXT_SYS_PD int argc; t_atom *argv; canvas_getargs(&argc,&argv); - args(argc); - for(int i = 0; i < argc; ++i) args[i] = argv[i]; + args(argc,argv); #else #pragma message("Not implemented") args(0); #endif } + + +#if FLEXT_SYS == FLEXT_SYS_MAX +static short patcher_myvol(t_patcher *x) +{ + t_box *w; + if(x->p_vol) + return x->p_vol; + else if((w = (t_box *)x->p_vnewobj) != NULL) + return patcher_myvol(w->b_patcher); + else + return 0; +} +#endif + +void flext_obj::GetCanvasDir(char *buf,size_t bufsz) const +{ +#if FLEXT_SYS == FLEXT_SYS_PD + const char *c = GetString(canvas_getdir(thisCanvas())); + strncpy(buf,c,bufsz); +#elif FLEXT_SYS == FLEXT_SYS_MAX + short path = patcher_myvol(thisCanvas()); + // \TODO dangerous!! no check for path length (got to be long enough... like 1024 chars) + path_topathname(path,NULL,buf); +#else +#error Not implemented +#endif +} diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index d20f1866..664dc15b 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -257,7 +257,10 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): static bool GetParamSym(t_atom &dst,const t_symbol *s,t_canvas *c); //! Get the canvas arguments - void CanvasArgs(AtomList &args) const; + void GetCanvasArgs(AtomList &args) const; + + //! Get the canvas/patcher directory + void GetCanvasDir(char *buf,size_t bufsz) const; //! @} FLEXT_OBJ_INTERNAL }; -- cgit v1.2.1