diff options
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flattr_ed.cpp | 3 | ||||
-rw-r--r-- | externals/grill/flext/source/flbind.cpp | 9 | ||||
-rw-r--r-- | externals/grill/flext/source/flbuf.cpp | 8 | ||||
-rw-r--r-- | externals/grill/flext/source/flclass.h | 11 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 37 | ||||
-rw-r--r-- | externals/grill/flext/source/flinternal.h | 1 | ||||
-rwxr-xr-x | externals/grill/flext/source/flitem.cpp | 11 |
7 files changed, 60 insertions, 20 deletions
diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp index 7b12a489..8757c803 100644 --- a/externals/grill/flext/source/flattr_ed.cpp +++ b/externals/grill/flext/source/flattr_ed.cpp @@ -419,14 +419,12 @@ void flext_base::SetAttrEditor(t_classid c) widgetbehavior.w_displacefn = c->c_wb->w_displacefn; widgetbehavior.w_activatefn = c->c_wb->w_activatefn; widgetbehavior.w_deletefn = c->c_wb->w_deletefn; - widgetbehavior.w_clickfn = c->c_wb->w_clickfn; widgetbehavior.w_selectfn = c->c_wb->w_selectfn; #else widgetbehavior.w_getrectfn = text_widgetbehavior.w_getrectfn; widgetbehavior.w_displacefn = text_widgetbehavior.w_displacefn; widgetbehavior.w_activatefn = text_widgetbehavior.w_activatefn; widgetbehavior.w_deletefn = text_widgetbehavior.w_deletefn; - widgetbehavior.w_clickfn = text_widgetbehavior.w_clickfn; widgetbehavior.w_selectfn = text_widgetbehavior.w_selectfn; #endif @@ -438,6 +436,7 @@ void flext_base::SetAttrEditor(t_classid c) widgetbehavior.w_savefn = cb_GfxSave; #endif + widgetbehavior.w_clickfn = cb_click; widgetbehavior.w_visfn = cb_GfxVis; widgetbehavior.w_selectfn = cb_GfxSelect; class_setwidget(c, &widgetbehavior); diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index 6e4d4f92..4ec9686b 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -165,13 +165,18 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym for(ItemSet::iterator si = it1; si != it2 && !it; ++si) { for(Item *i = si.data(); i; i = i->nxt) { BindItem *item = (BindItem *)i; - if(!fun || item->fun == fun) { it = item; break; } + if(!fun || item->fun == fun) + { + it = item; + if(!sym) sym = si.key(); + break; + } } } if(it) { if(data) *data = it->px->data; - ok = bindhead->Remove(it,sym); + ok = bindhead->Remove(it,sym,0,false); if(ok) { it->Unbind(sym); delete it; diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index e42015c6..1d2ff839 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -43,8 +43,12 @@ flext::buffer::buffer(const t_symbol *bn,bool delayed): ticking = false; tick = clock_new(this,(t_method)cb_tick); #elif FLEXT_SYS == FLEXT_SYS_MAX - if(!sym_buffer) sym_buffer = flext::MakeSymbol("buffer~"); - if(!sym_size) sym_size = flext::MakeSymbol("size"); + // for some strange reasons (maybe only on Mac) + // static initializations are not processed + if(!sym_buffer) { + sym_buffer = flext::MakeSymbol("buffer~"); + sym_size = flext::MakeSymbol("size"); + } #endif if(bn) Set(bn,delayed); diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index edf8866c..dc444260 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -91,8 +91,8 @@ public: //! called on patcher load (not on mere object creation!) virtual void m_loadbang(); - //! quickhelp for inlets/outlets (gets called in Max/MSP only) - virtual void m_assist(long /*msg*/,long /*arg*/,char * /*s*/); + //! called on (double-)click into object box + virtual void m_click(); /*! \brief Called for every incoming message. All method handling is done in there @@ -643,7 +643,7 @@ protected: //! Add an entry void Add(Item *it,const t_symbol *tag,int inlet = 0); //! Remove an entry - bool Remove(Item *it,const t_symbol *tag,int inlet = 0); + bool Remove(Item *it,const t_symbol *tag,int inlet,bool free); //! Find an entry list in the Item array Item *FindList(const t_symbol *tag,int inlet = 0); @@ -978,10 +978,15 @@ private: static void cb_loadbang(t_class *c); #endif +#if FLEXT_SYS == FLEXT_SYS_PD + static int cb_click(t_gobj *z, struct _glist *glist,int xpix, int ypix, int shift, int alt, int dbl, int doit); +#endif + #if FLEXT_SYS == FLEXT_SYS_MAX char **indesc,**outdesc; static void cb_assist(t_class *c,void *b,long msg,long arg,char *s); + static void cb_click (t_class *c, Point pt, short mods); #endif }; diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index fc960f01..1e932360 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -148,6 +148,7 @@ void flext_base::Setup(t_classid id) add_loadbang(c,cb_loadbang); #if FLEXT_SYS == FLEXT_SYS_MAX add_assist(c,cb_assist); + add_dblclick(c,cb_click); #endif #else fts_class_message_varargs(c,MakeSymbol("help"),cb_help); @@ -184,23 +185,41 @@ void flext_base::m_help() void flext_base::m_loadbang() {} -#if FLEXT_SYS == FLEXT_SYS_MAX -void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s) { thisObject(c)->m_assist(msg,arg,s); } -#endif +void flext_base::m_click() {} -void flext_base::m_assist(long msg,long arg,char *s) +#if FLEXT_SYS == FLEXT_SYS_PD +int flext_base::cb_click(t_gobj *c, struct _glist *glist,int xpix, int ypix, int shift, int alt, int dbl, int doit) { + if(doit && alt) { + thisObject(c)->m_click(); + return 1; + } + else + return 0; +} +#endif + #if FLEXT_SYS == FLEXT_SYS_MAX +void flext_base::cb_click(t_class *c, Point pt, short mods) +{ + thisObject(c)->m_click(); +} + +void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s) +{ + flext_base *th = thisObject(c); + switch(msg) { case 1: //ASSIST_INLET: - strcpy(s,arg < incnt && indesc[arg]?indesc[arg]:""); + if(arg < th->incnt && th->indesc[arg]) strcpy(s,th->indesc[arg]); break; case 2: //ASSIST_OUTLET: - if(arg < outcnt) - strcpy(s,outdesc[arg]?outdesc[arg]:""); + if(arg < th->outcnt) { + if(th->outdesc[arg]) strcpy(s,th->outdesc[arg]); + } else - strcpy(s,arg == outcnt && procattr?"Attributes":""); + if(arg == th->outcnt && th->procattr) strcpy(s,"Attributes"); break; } -#endif } +#endif diff --git a/externals/grill/flext/source/flinternal.h b/externals/grill/flext/source/flinternal.h index 0bdc3bf6..1a1f0f4b 100644 --- a/externals/grill/flext/source/flinternal.h +++ b/externals/grill/flext/source/flinternal.h @@ -91,6 +91,7 @@ typedef void t_outlet; #define add_assist(clss,meth) addmess((method)meth, "assist", A_CANT, A_NULL) #define add_loadbang(clss,meth) addmess((method)meth, "loadbang", A_CANT, A_NULL) +#define add_dblclick(clss,meth) addmess((method)meth, "dblclick", A_CANT, A_NULL) #define newout_signal(clss) outlet_new(clss,"signal") #define newout_float(clss) outlet_new(clss,"float") diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp index 90c357d9..0c3f0f03 100755 --- a/externals/grill/flext/source/flitem.cpp +++ b/externals/grill/flext/source/flitem.cpp @@ -60,6 +60,8 @@ void flext_base::ItemCont::Resize(int nsz) void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet) { + FLEXT_ASSERT(tag); + if(!Contained(inlet)) Resize(inlet+2); ItemSet &set = GetInlet(inlet); Item *&lst = set[tag]; @@ -72,8 +74,10 @@ void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet) members++; } -bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet) +bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool free) { + FLEXT_ASSERT(tag); + if(Contained(inlet)) { ItemSet &set = GetInlet(inlet); ItemSet::iterator it = set.find(tag); @@ -83,7 +87,8 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet) if(prv) prv->nxt = lit->nxt; else it.data() = lit->nxt; - lit->nxt = NULL; delete lit; + lit->nxt = NULL; + if(free) delete lit; return true; } } @@ -94,6 +99,8 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet) flext_base::Item *flext_base::ItemCont::FindList(const t_symbol *tag,int inlet) { + FLEXT_ASSERT(tag); + if(Contained(inlet)) { ItemSet &ai = GetInlet(inlet); ItemSet::iterator as = ai.find(tag); |