From b24219e6ab0ce96f0d60f7a5f122c52b2c7e40aa Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 19 Jul 2003 02:41:33 +0000 Subject: "" svn path=/trunk/; revision=778 --- externals/grill/flext/changes.txt | 5 +- externals/grill/flext/config-pd-msvc.txt | 5 +- externals/grill/flext/make-inc.pd-msvc | 2 +- externals/grill/flext/source/flbase.cpp | 4 +- externals/grill/flext/source/flbase.h | 24 ++++---- externals/grill/flext/source/flclass.h | 17 +++--- externals/grill/flext/source/fldsp.cpp | 4 +- externals/grill/flext/source/fldsp.h | 12 ++-- externals/grill/flext/source/flext.cpp | 4 +- externals/grill/flext/source/fllib.cpp | 2 +- externals/grill/flext/source/flprefix.h | 55 +++++++++++++---- externals/grill/flext/source/flsupport.cpp | 2 +- externals/grill/flext/source/flsupport.h | 34 ++++++----- externals/grill/flext/source/flthr.cpp | 11 ++-- externals/grill/guitest/flgui.cpp | 94 +++++++++++++++++++++++++++++- externals/grill/guitest/flgui.h | 2 +- externals/grill/guitest/main.cpp | 42 +++++++------ externals/grill/xsample/source/inter.h | 1 - 18 files changed, 236 insertions(+), 84 deletions(-) (limited to 'externals') diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 982e0002..afcb2b2f 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -16,7 +16,7 @@ Version history: 0.5.0: - added some more SIMD functions - fixed wrong returned result of flext::buffer::set function -- fix for linux static exported function name-clash (flext::Setup() single- vs. multi-threading) +- fix for linux static exported function name-clash (individual linker namings for exported flext base classes) - made message queue stuff global (static) for all flext objects - added flext_base::DumpAttrib to send an attribute value to the attribute outlet - added "getmethods" message (for attribute-enabled externals) to list methods for a specified inlet (default = 0) @@ -25,6 +25,7 @@ Version history: - added flext::post() and flext::error() console printing (thread-safe) - added flext::CmpAtom and AtomList::operator < methods ... useful for using lists as keys for STL - make use of new PD thread locking (PD functions sys_lock() and sys_unlock()) +- better FLEXT_OSAPI resolution 0.4.4: - fixed deadly bug for Max/MSP method-to-symbol-binding proxies @@ -266,6 +267,8 @@ general: - add log messages for debugging version - use PD's t_float and t_int types (or comparable for 32-Bit safety) +- make links flext.a -> libflext.a for compatibility + bugs: - PD: problems with timed buffer redrawing (takes a lot of cpu time) - hard thread termination upon object destruction doesn't seem to work properly -> crash diff --git a/externals/grill/flext/config-pd-msvc.txt b/externals/grill/flext/config-pd-msvc.txt index cac79b55..d754b23e 100644 --- a/externals/grill/flext/config-pd-msvc.txt +++ b/externals/grill/flext/config-pd-msvc.txt @@ -5,8 +5,9 @@ # where is PD? PDPATH=c:\programme\audio\pd -# where is MS VC++? -MSVCPATH="c:\programme\prog\microsoft visual studio\VC98" +# where is MS VC++? +# (should be commented out when called from the Visual Studio Command prompt) +# MSVCPATH="c:\programme\prog\microsoft visual studio\VC98" # where is the SndObj include directory? # (leave blank or comment out to disable SndObj support) diff --git a/externals/grill/flext/make-inc.pd-msvc b/externals/grill/flext/make-inc.pd-msvc index bfe4bb2a..3bf75633 100644 --- a/externals/grill/flext/make-inc.pd-msvc +++ b/externals/grill/flext/make-inc.pd-msvc @@ -24,7 +24,7 @@ INCPATH=$(INCPATH) /I$(STK) # compiler definitions and flags DEFS=/DFLEXT_SYS=2 $(UFLAGS) -CFLAGS=/GX /GD /G6 +CFLAGS=/GX /GD /G6 /arch:SSE OFLAGS=/Ox DFLAGS=/Od /Zi diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp index aa6b66ea..525cb294 100644 --- a/externals/grill/flext/source/flbase.cpp +++ b/externals/grill/flext/source/flbase.cpp @@ -37,7 +37,7 @@ void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; } // Constructor // ///////////////////////////////////////////////////////// -flext_obj :: flext_obj() +flext_obj :: FLEXT_CLASSDEF(flext_obj)() : x_obj(m_holder) , procattr(m_holdattr) , init_ok(true) @@ -55,7 +55,7 @@ flext_obj :: flext_obj() // Destructor // ///////////////////////////////////////////////////////// -flext_obj :: ~flext_obj() { +flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() { x_obj = NULL; } diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index 4d0541b8..795c0673 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -20,7 +20,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstdc.h" #include "flsupport.h" -class FLEXT_SHARE flext_obj; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj); +typedef class FLEXT_CLASSDEF(flext_obj) flext_obj; // ---------------------------------------------------------------------------- /*! \brief The obligatory PD or Max/MSP object header @@ -56,7 +58,7 @@ struct FLEXT_SHARE flext_hdr /*! \brief This points to the actual polymorphic C++ class */ - flext_obj *data; + FLEXT_CLASSDEF(flext_obj) *data; //! @} FLEXT_OBJHEADER }; @@ -85,7 +87,7 @@ struct FLEXT_SHARE flext_hdr */ // ---------------------------------------------------------------------------- -class FLEXT_SHARE flext_obj: +class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): public flext { public: @@ -100,10 +102,10 @@ class FLEXT_SHARE flext_obj: */ //! Constructor - flext_obj(); + FLEXT_CLASSDEF(flext_obj)(); //! Destructor - virtual ~flext_obj() = 0; + virtual ~FLEXT_CLASSDEF(flext_obj)() = 0; /*! \brief Signal a construction problem \note This should only be used in the constructor. Object creation will be aborted. @@ -221,7 +223,7 @@ class FLEXT_SHARE flext_obj: public: //! Creation callback - static void __setup__(t_classid) { flext::FLEXT_SETUPFUNC(); } + static void __setup__(t_classid) { flext::Setup(); } /*! \brief This is a temporary holder \warning don't touch it! @@ -243,7 +245,7 @@ class FLEXT_SHARE flext_obj: // Definitions for library objects static void lib_init(const char *name,void setupfun(),bool attr); - static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),flext_obj *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...); + static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),FLEXT_CLASSDEF(flext_obj) *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...); #if FLEXT_SYS == FLEXT_SYS_JMAX static void obj_new(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); static void obj_free(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); @@ -293,9 +295,9 @@ class FLEXT_SHARE flext_obj: #define FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) \ public: \ typedef NEW_CLASS thisType; \ -static flext_obj *__init__(int argc,t_atom *argv); \ +static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \ static void __free__(flext_hdr *hdr) \ -{ flext_obj *mydata = hdr->data; delete mydata; \ +{ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \ hdr->flext_hdr::~flext_hdr(); } \ static void __setup__(t_classid classid) { \ PARENT_CLASS::__setup__(classid); } \ @@ -306,9 +308,9 @@ static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST((( #define FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS,SETUPFUN) \ public: \ typedef NEW_CLASS thisType; \ -static flext_obj *__init__(int argc,t_atom *argv); \ +static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \ static void __free__(flext_hdr *hdr) \ -{ flext_obj *mydata = hdr->data; delete mydata; \ +{ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \ hdr->flext_hdr::~flext_hdr(); } \ static void __setup__(t_classid classid) \ { PARENT_CLASS::__setup__(classid); \ diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 3667e961..6b361cc7 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -36,9 +36,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. /*! \brief Flext message only base object - This is the base class from which typical external object derive. + This is the base class from which typical external objects derive. DSP objects should use the flext_dsp class which inherits from flext_base and - provides the needed functionality. + provides the necessary functionality. For a valid external object class you would also need FLEXT_HEADER, also if it's only a base class without instantiated objects again. @@ -49,12 +49,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ -class FLEXT_SHARE flext_base: +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base); +typedef class FLEXT_SHARE FLEXT_CLASSDEF(flext_base) flext_base; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base): public flext_obj { - FLEXT_HEADER_S(flext_base,flext_obj,Setup) + FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_base),flext_obj,Setup) - friend class flext_obj; + friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj); /*! \defgroup FLEXT_CLASS Flext base class @{ @@ -469,8 +472,8 @@ public: protected: - flext_base(); - virtual ~flext_base(); + FLEXT_CLASSDEF(flext_base)(); + virtual ~FLEXT_CLASSDEF(flext_base)(); /*! \brief Set up inlets and outlets, method and attribute lists */ diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 252f2da7..6d3298b2 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -43,7 +43,7 @@ void flext_dsp::Setup(t_classid id) #endif } -flext_dsp::flext_dsp(): +flext_dsp::FLEXT_CLASSDEF(flext_dsp)(): #if FLEXT_SYS == FLEXT_SYS_JMAX srate(fts_dsp_get_sample_rate()), // should we set it? blksz(fts_dsp_get_tick_size()), @@ -74,7 +74,7 @@ flext_dsp::flext_dsp(): } -flext_dsp::~flext_dsp() +flext_dsp::~FLEXT_CLASSDEF(flext_dsp)() { #if FLEXT_SYS == FLEXT_SYS_JMAX fts_dsp_object_delete(thisHdr()); diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index 80631531..ee94973d 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -22,12 +22,16 @@ WARRANTIES, see the file, "license.txt," in this distribution. // === flext_dsp ================================================== +class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp); +typedef class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp) flext_dsp; + + /*! \brief Flext dsp enabled base object */ -class FLEXT_SHARE flext_dsp: +class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp): public flext_base { - FLEXT_HEADER_S(flext_dsp,flext_base,Setup) + FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_dsp),flext_base,Setup) public: @@ -132,8 +136,8 @@ public: protected: - flext_dsp(); - virtual ~flext_dsp(); + FLEXT_CLASSDEF(flext_dsp)(); + virtual ~FLEXT_CLASSDEF(flext_dsp)(); private: diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 78f01ff5..ce35e205 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -20,7 +20,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. bool flext_base::compatibility = true; -flext_base::flext_base(): +flext_base::FLEXT_CLASSDEF(flext_base)(): inlist(NULL),outlist(NULL), curtag(NULL), incnt(0),outcnt(0), @@ -49,7 +49,7 @@ flext_base::flext_base(): attrhead = clattrhead = NULL; } -flext_base::~flext_base() +flext_base::~FLEXT_CLASSDEF(flext_base)() { #if FLEXT_SYS == FLEXT_SYS_MAX // according to David Z. one should do that first... diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index f84968f2..a6d95895 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -194,7 +194,7 @@ t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast void flext_obj::lib_init(const char *name,void setupfun(),bool attr) { - flext::FLEXT_SETUPFUNC(); + flext::Setup(); #if FLEXT_SYS == FLEXT_SYS_MAX lib_name = MakeSymbol(name); diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index 2399eef5..4d34a975 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -54,9 +54,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. // --- definitions for FLEXT_OS_API --------------------- #define FLEXT_OSAPI_UNKNOWN 0 -#define FLEXT_OSAPI_MAC_CLASSIC 1 -#define FLEXT_OSAPI_MAC_CARBON 2 -#define FLEXT_OSAPI_MAC_OSX 3 + +#define FLEXT_OSAPI_UNIX_POSIX 1 + +#define FLEXT_OSAPI_MAC_CLASSIC 2 +#define FLEXT_OSAPI_MAC_CARBON 3 +#define FLEXT_OSAPI_MAC_OSX 4 + +#define FLEXT_OSAPI_WIN_NATIVE 5 // WIN32 Platform +#define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin) // --- definitions for FLEXT_CPU --------------------- #define FLEXT_CPU_UNKNOWN 0 @@ -120,12 +126,13 @@ WARRANTIES, see the file, "license.txt," in this distribution. #ifndef FLEXT_OS #if defined(_WIN32) #define FLEXT_OS FLEXT_OS_WIN + #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE #else #define FLEXT_OS FLEXT_OS_UNKNOWN + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #endif #endif - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #elif defined(__BORLANDC__) // Borland C++ @@ -135,9 +142,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #ifndef FLEXT_OS #define FLEXT_OS FLEXT_OS_WIN + #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE + #else + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #endif - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #elif defined(__MWERKS__) // Metrowerks CodeWarrior @@ -224,14 +233,21 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif - #if FLEXT_OS == FLEXT_OS_MAC - #define FLEXT_OSAPI FLEXT_OSAPI_MAC_OSX - #else - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN + #ifndef FLEXT_OSAPI + #if FLEXT_OS == FLEXT_OS_MAC + #define FLEXT_OSAPI FLEXT_OSAPI_MAC_OSX + #elif FLEXT_OS == FLEXT_OS_WIN + #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX + #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX + #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX + #else + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN + #endif #endif #elif defined(__MRC__) && defined(MPW_CPLUS) // Apple MPW MrCpp + #if __MRC__ < 0x500 #error Apple MPW MrCpp v.5.0.0 or better compiler required #endif @@ -252,10 +268,17 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN - + #ifndef FLEXT_OSAPI + #if FLEXT_OS == FLEXT_OS_MAC + #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC + #else + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN + #endif + #endif #endif + + #if FLEXT_OS == FLEXT_OS_WIN // #pragma message("Compiling for Windows") @@ -334,6 +357,16 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif +// ----- macros for class names ----- +#if defined(FLEXT_SHARED) + #define FLEXT_CLASSDEF(CL) CL##_shared +#elif defined(FLEXT_THREADS) + #define FLEXT_CLASSDEF(CL) CL##_multi +#else + #define FLEXT_CLASSDEF(CL) CL##_single +#endif + + // std namespace #ifdef __MWERKS__ #define STD std diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index 78aeb6d0..14b9bea5 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -35,7 +35,7 @@ const t_symbol *flext::sym_signal = NULL; int flext::Version() { return FLEXT_VERSION; } const char *flext::VersionStr() { return FLEXT_VERSTR; } -void flext::FLEXT_SETUPFUNC() +void flext::Setup() { static bool issetup = false; if(issetup) diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index b2132289..789e6921 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -18,7 +18,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstdc.h" -class FLEXT_SHARE flext_base; +class FLEXT_SHARE FLEXT_CLASSDEF(flext); +typedef class FLEXT_CLASSDEF(flext) flext; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base); /*! \brief Flext support class @@ -31,7 +34,8 @@ class FLEXT_SHARE flext_base; This class can also be used for a non-object class (not representing an external object) and won't give any extra burden to it. */ -class FLEXT_SHARE flext { + +class FLEXT_SHARE FLEXT_CLASSDEF(flext) { /*! \defgroup FLEXT_SUPPORT Flext support class @{ @@ -644,7 +648,7 @@ public: void set_any(const t_symbol *s,int argc,const t_atom *argv); void set_list(int argc,const t_atom *argv); - flext_base *cl; + FLEXT_CLASSDEF(flext_base) *cl; union _data { bool _bool; float _float; @@ -667,10 +671,10 @@ public: //! \brief Check if this class represents the current thread bool Is(thrid_t id = GetThreadId()) const { return IsThread(thrid,id); } - flext_base *This() const { return th; } + FLEXT_CLASSDEF(flext_base) *This() const { return th; } thrid_t Id() const { return thrid; } - flext_base *th; + FLEXT_CLASSDEF(flext_base) *th; void (*meth)(thr_params *); thr_params *params; thrid_t thrid; @@ -913,7 +917,7 @@ public: //! Set timer callback function. void SetCallback(void (*cb)(void *data)) { clss = NULL,cback = cb; } //! Set timer callback function (with class pointer). - void SetCallback(flext_base &th,bool (*cb)(flext_base *th,void *data)) { clss = &th,cback = (void (*)(void *))cb; } + void SetCallback(FLEXT_CLASSDEF(flext_base) &th,bool (*cb)(FLEXT_CLASSDEF(flext_base) *th,void *data)) { clss = &th,cback = (void (*)(void *))cb; } //! Clear timer. bool Reset(); @@ -944,7 +948,7 @@ public: const bool queued; void (*cback)(void *data); - flext_base *clss; + FLEXT_CLASSDEF(flext_base) *clss; void *userdata; double period; }; @@ -990,12 +994,16 @@ protected: As single- and multi-threaded to different initializations the function names have to be different as well. */ + +/* #ifdef FLEXT_THREADS #define FLEXT_SETUPFUNC SetupMulti #else #define FLEXT_SETUPFUNC SetupSingle #endif static void FLEXT_SETUPFUNC(); +*/ + static void Setup(); static bool chktilde(const char *objname); @@ -1004,12 +1012,12 @@ protected: // gcc doesn't like these to be included into the flext class (even if static) -inline bool operator ==(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) == 0; } -inline bool operator !=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) != 0; } -inline bool operator <(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) < 0; } -inline bool operator <=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) <= 0; } -inline bool operator >(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) > 0; } -inline bool operator >=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) >= 0; } +inline bool operator ==(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) == 0; } +inline bool operator !=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) != 0; } +inline bool operator <(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) < 0; } +inline bool operator <=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) <= 0; } +inline bool operator >(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) > 0; } +inline bool operator >=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) >= 0; } diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index 0846805c..598618f1 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -20,11 +20,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include -#if FLEXT_OS == FLEXT_OS_WIN -#include -#elif FLEXT_OS == FLEXT_OS_LINUX +#if FLEXT_OSAPI == FLEXT_OSAPI_UNIX_POSIX || FLEXT_OSAPI == FLEXT_OSAPI_WIN_POSIX #include #include +#elif FLEXT_OS == FLEXT_OS_WIN +#include #endif #include @@ -514,12 +514,12 @@ bool flext::ThrCond::Wait() { bool flext::ThrCond::TimedWait(double ftime) { timespec tm; -#if FLEXT_OS == FLEXT_OS_WIN +#if FLEXT_OS == FLEXT_OS_WIN && FLEXT_OSAPI == FLEXT_OSAPI_WIN_NATIVE _timeb tmb; _ftime(&tmb); tm.tv_nsec = tmb.millitm*1000000; tm.tv_sec = tmb.time; -#else +#else // POSIX #if 0 // find out when the following is defined clock_gettime(CLOCK_REALTIME,tm); #else @@ -529,6 +529,7 @@ bool flext::ThrCond::TimedWait(double ftime) tm.tv_sec = tp.tv_sec; #endif #endif + tm.tv_nsec += (long)((ftime-(long)ftime)*1.e9); long nns = tm.tv_nsec%1000000000; tm.tv_sec += (long)ftime+(tm.tv_nsec-nns)/1000000000; diff --git a/externals/grill/guitest/flgui.cpp b/externals/grill/guitest/flgui.cpp index 1771e992..b91f10a4 100644 --- a/externals/grill/guitest/flgui.cpp +++ b/externals/grill/guitest/flgui.cpp @@ -67,7 +67,7 @@ flext_gui::~flext_gui() } -void flext_gui::setup(t_class *c) +void flext_gui::setup(t_classid c) { #if FLEXT_SYS == FLEXT_SYS_PD SetWidget(c); @@ -95,6 +95,91 @@ void flext_gui::setup(t_class *c) // this is wrong if a modifier key is pressed during creation of the first object..... curmod = 0; + + + + sys_gui( + "proc flgui_apply {id} {\n" + // strip "." from the TK id to make a variable name suffix + "set vid [string trimleft $id .]\n" + + // for each variable, make a local variable to hold its name... + "set var_graph_width [concat graph_width_$vid]\n" + "global $var_graph_width\n" + "set var_graph_height [concat graph_height_$vid]\n" + "global $var_graph_height\n" + "set var_graph_draw [concat graph_draw_$vid]\n" + "global $var_graph_draw\n" + + "set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_draw] \\;]\n" + // puts stderr $cmd + "pd $cmd\n" + "}\n" + + "proc flgui_cancel {id} {\n" + "set cmd [concat $id cancel \\;]\n" + // puts stderr $cmd + "pd $cmd\n" + "}\n" + + "proc flgui_ok {id} {\n" + "flgui_apply $id\n" + "flgui_cancel $id\n" + "}\n" + + "proc pdtk_flgui_dialog {id width height draw} {\n" + "set vid [string trimleft $id .]\n" + + "set var_graph_width [concat graph_width_$vid]\n" + "global $var_graph_width\n" + "set var_graph_height [concat graph_height_$vid]\n" + "global $var_graph_height\n" + "set var_graph_draw [concat graph_draw_$vid]\n" + "global $var_graph_draw\n" + + "set $var_graph_width $width\n" + "set $var_graph_height $height\n" + "set $var_graph_draw $draw\n" + + "toplevel $id\n" + "wm title $id {flext}\n" + "wm protocol $id WM_DELETE_WINDOW [concat flgui_cancel $id]\n" + + "label $id.label -text {Attributes}\n" + "pack $id.label -side top\n" + + "frame $id.buttonframe\n" + "pack $id.buttonframe -side bottom -fill x -pady 2m\n" + + "button $id.buttonframe.cancel -text {Cancel} -command \"flgui_cancel $id\"\n" + "button $id.buttonframe.apply -text {Apply} -command \"flgui_apply $id\"\n" + "button $id.buttonframe.ok -text {OK} -command \"flgui_ok $id\"\n" + + "pack $id.buttonframe.cancel -side left -expand 1\n" + "pack $id.buttonframe.apply -side left -expand 1\n" + "pack $id.buttonframe.ok -side left -expand 1\n" + + "frame $id.1rangef\n" + "pack $id.1rangef -side top\n" + "label $id.1rangef.lwidth -text \"Width :\"\n" + "entry $id.1rangef.width -textvariable $var_graph_width -width 7\n" + "pack $id.1rangef.lwidth $id.1rangef.width -side left\n" + + "frame $id.2rangef\n" + "pack $id.2rangef -side top\n" + "label $id.2rangef.lheight -text \"Height :\"\n" + "entry $id.2rangef.height -textvariable $var_graph_height -width 7\n" + "pack $id.2rangef.lheight $id.2rangef.height -side left\n" + + "checkbutton $id.draw -text {Draw Sample} -variable $var_graph_draw -anchor w\n" + "pack $id.draw -side top\n" + + "bind $id.1rangef.width [concat flgui_ok $id]\n" + "bind $id.2rangef.height [concat flgui_ok $id]\n" + "focus $id.1rangef.width\n" + "}\n" + ); + #else addmess((method)sg_update, "update", A_CANT, A_NULL); addmess((method)sg_click, "click", A_CANT, A_NULL); @@ -262,6 +347,13 @@ void flext_gui::pxkey_method(pxkey_object *obj,const t_symbol *s,int argc,t_atom post("flext_gui key proxy - unknown method"); } +void flext_gui::g_Properties() +{ + char buf[800]; + sprintf(buf, "pdtk_flgui_dialog %%s %d %d %d\n",0, 0, 0); + gfxstub_new((t_pd *)thisHdr(), thisHdr(), buf); +} + flext_gui::guicanv::guicanv(t_canvas *c): canv(c),nxt(NULL),ref(0), diff --git a/externals/grill/guitest/flgui.h b/externals/grill/guitest/flgui.h index ab512a1a..0f62f01b 100644 --- a/externals/grill/guitest/flgui.h +++ b/externals/grill/guitest/flgui.h @@ -64,7 +64,7 @@ protected: virtual void g_Displace(int dx, int dy); // virtual void g_Activate(bool state) {} // virtual int g_Click(int xpix, int ypix, int shift, int alt, int dbl, int doit) { return 0; } - virtual void g_Properties() {} + virtual void g_Properties(); virtual void g_Save(t_binbuf *b) {} /* virtual bool g_Motion(GuiObj &obj,int x,int y,int mod) { return false; } diff --git a/externals/grill/guitest/main.cpp b/externals/grill/guitest/main.cpp index fa5a6f71..96e168dc 100644 --- a/externals/grill/guitest/main.cpp +++ b/externals/grill/guitest/main.cpp @@ -37,13 +37,13 @@ public: protected: virtual void g_Create(); - virtual void g_Edit(bool selected); +// virtual void g_Edit(bool selected); static bool g_Motion(flext_gui &g,GuiSingle &obj,const CBParams &p); static bool g_MouseKey(flext_gui &g,GuiSingle &obj,const CBParams &p); static bool g_Key(flext_gui &g,GuiSingle &obj,const CBParams &p); - virtual void g_Properties(); +// virtual void g_Properties(); virtual void g_Save(t_binbuf *b); private: @@ -52,14 +52,27 @@ private: FLEXT_NEW_V("guitest",guitest) +guitest::guitest(I argc,t_atom *argv): + flext_gui(400,100) +{ + AddInAnything(); + AddOutInt(2); + + FLEXT_ADDBANG(0,m_bang); +} + +guitest::~guitest() +{ +} + void guitest::g_Create() { GuiSingle *frame = Group().Add_Box(0,0,XSize(),YSize(),-1,0xE0E0E0); frame->Symbol("rect1"); - GuiSingle *wave = Group().Add_Box(8,10,XSize()-16,YSize()-11,0,0x4040FF); - Group().Add_Text(1,1,"Hula",-1); - +// GuiSingle *wave = Group().Add_Box(8,10,XSize()-16,YSize()-11,0,0x4040FF); + Group().Add_Text(1,1,"Hula",-1,GuiText::left); +/* I n = XSize()-16; FPnt *p = new FPnt[n]; for(int i = 0; i < n; ++i) { @@ -74,12 +87,15 @@ void guitest::g_Create() if(!BindEvent(*wave,g_MouseKey,evKeyDown)) post("KeyDown not supported"); if(!BindEvent(*wave,g_MouseKey,evKeyUp)) post("KeyUp not supported"); if(!BindEvent(*wave,g_MouseKey,evKeyRepeat)) post("KeyRepeat not supported"); +*/ } +/* void guitest::g_Properties() { - post("properties"); + post("properties"); } +*/ void guitest::g_Save(t_binbuf *b) { @@ -93,6 +109,7 @@ void guitest::g_Save(t_binbuf *b) #endif } +/* void guitest::g_Edit(bool selected) { post("select is=%d", selected); @@ -103,6 +120,7 @@ void guitest::g_Edit(bool selected) else post("obj not found"); } +*/ bool guitest::g_Motion(flext_gui &g,GuiSingle &obj,const CBParams &p) { @@ -144,17 +162,5 @@ bool guitest::g_Key(flext_gui &g,GuiSingle &obj,const CBParams &p) -guitest::guitest(I argc,t_atom *argv): - flext_gui(400,100) -{ - AddInAnything(); - AddOutInt(2); - - FLEXT_ADDBANG(0,m_bang); -} - -guitest::~guitest() -{ -} diff --git a/externals/grill/xsample/source/inter.h b/externals/grill/xsample/source/inter.h index bd8ec894..602bfd49 100755 --- a/externals/grill/xsample/source/inter.h +++ b/externals/grill/xsample/source/inter.h @@ -186,5 +186,4 @@ TMPLDEF inline V xinter::s_play4(I n,S *const *invecs,S *const *outvecs) st_play4 TMPLCALL (buf->Data(),curmin,curmax,n,buf->Channels(),outchns,invecs,outvecs); } - #endif -- cgit v1.2.1