From 0f849641afd27b4e7c9326fbcd402105fd62ced0 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 26 Sep 2005 13:59:34 +0000 Subject: - better handling of click callback bugfixes and optimizations, especially for DSP under Max/MSP - more compatible handling of attributes in patcher (hiding is now an option - define FLEXT_ATTRHIDE) svn path=/trunk/; revision=3636 --- externals/grill/flext/source/flext.cpp | 63 +++++++++++++++++----------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'externals/grill/flext/source/flext.cpp') diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 70184bef..4d62633e 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -48,19 +48,42 @@ flext_base::FLEXT_CLASSDEF(flext_base)() } } -flext_base::~FLEXT_CLASSDEF(flext_base)() +/*! This virtual function is called after the object has been created, that is, + after the constructor has been processed. + It creates the inlets and outlets and the message and attribute lists. + \note You can override it in your own class, but be sure to call it, + \note otherwise no inlets/outlets will be created + \note All inlet, outlets, method and attribute declarations must be made before a call to Init! + \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation + \remark in reverse. +*/ +bool flext_base::Init() +{ + bool ok = flext_obj::Init(); + + if(ok) ok = InitInlets() && InitOutlets(); + + if(ok) { + if(HasAttributes() && m_holdaargc && m_holdaargv) { + // initialize creation attributes + ok = InitAttrib(m_holdaargc,m_holdaargv); + } + } + + return ok; +} + + +/*! This virtual function is called before the destructor. + We do this because here we can still call virtual methods. +*/ +void flext_base::Exit() { #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT) // attribute editor window may still be open -> close it gfxstub_deleteforkey(thisHdr()); #endif -#if FLEXT_SYS == FLEXT_SYS_MAX - // according to David Z. one should do that first... - if(insigs) dsp_free(thisHdr()); -// if(insigs) dsp_freebox(thisHdr()); -#endif - #ifdef FLEXT_THREADS StopThreads(); #endif @@ -101,33 +124,11 @@ flext_base::~FLEXT_CLASSDEF(flext_base)() delete[] outdesc; } #endif -} -/*! This virtual function is called after the object has been created, that is, - after the constructor has been processed. - It creates the inlets and outlets and the message and attribute lists. - \note You can override it in your own class, but be sure to call it, - \note otherwise no inlets/outlets will be created - \note All inlet, outlets, method and attribute declarations must be made before a call to Init! - \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation - \remark in reverse. -*/ -bool flext_base::Init() -{ - bool ok = flext_obj::Init(); - - if(ok) ok = InitInlets() && InitOutlets(); - - if(ok) { - if(HasAttributes() && m_holdaargc && m_holdaargv) { - // initialize creation attributes - ok = InitAttrib(m_holdaargc,m_holdaargv); - } - } - - return ok; + flext_obj::Exit(); } + /*! Set up proxy classes and basic methods at class creation time This ensures that they are processed before the registered flext messages */ -- cgit v1.2.1