Update of /cvsroot/pure-data/externals/grill/dyn/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6020/src
Modified Files:
main.cpp
Log Message:
""
Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/dyn/src/main.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** main.cpp 21 Jun 2004 14:06:53 -0000 1.11
--- main.cpp 21 Aug 2004 04:17:01 -0000 1.12
***************
*** 167,170 ****
--- 167,173 ----
FLEXT_CALLBACK_V(m_send)
FLEXT_CALLBACK_B(m_vis)
+
+ static const t_symbol *sym_dot,*sym_dynsin,*sym_dynsout,*sym_dynin,*sym_dynout,*sym_dyncanvas;
+ static const t_symbol *sym_vis,*sym_loadbang,*sym_dsp;
};
***************
*** 179,204 ****
const t_symbol *dyn::k_text = NULL;
void dyn::setup(t_classid c)
{
post("");
! post("dyn~ %s - dynamic object management, (C)2003 Thomas Grill",DYN_VERSION);
post("");
// set up proxy class for inbound messages
! pxin_class = class_new(gensym("dyn_in"),(t_newmethod)pxin_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
add_anything(pxin_class,proxyin::px_method);
// set up proxy class for inbound signals
! pxins_class = class_new(gensym("dyn_in~"),(t_newmethod)pxins_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
add_dsp(pxins_class,proxyin::dsp);
CLASS_MAINSIGNALIN(pxins_class, proxyin, defsig);
// set up proxy class for outbound messages
! pxout_class = class_new(gensym("dyn_out"),(t_newmethod)pxout_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
add_anything(pxout_class,proxyout::px_method);
// set up proxy class for outbound signals
! pxouts_class = class_new(gensym("dyn_out~"),(t_newmethod)pxouts_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
add_dsp(pxouts_class,proxyout::dsp);
CLASS_MAINSIGNALIN(pxouts_class, proxyout, defsig);
--- 182,226 ----
const t_symbol *dyn::k_text = NULL;
+ const t_symbol *dyn::sym_dot = NULL;
+ const t_symbol *dyn::sym_dynsin = NULL;
+ const t_symbol *dyn::sym_dynsout = NULL;
+ const t_symbol *dyn::sym_dynin = NULL;
+ const t_symbol *dyn::sym_dynout = NULL;
+ const t_symbol *dyn::sym_dyncanvas = NULL;
+
+ const t_symbol *dyn::sym_vis = NULL;
+ const t_symbol *dyn::sym_loadbang = NULL;
+ const t_symbol *dyn::sym_dsp = NULL;
+
void dyn::setup(t_classid c)
{
post("");
! post("dyn~ %s - dynamic object management, (C)2003-2004 Thomas Grill",DYN_VERSION);
post("");
+ sym_dynsin = MakeSymbol("dyn_in~");
+ sym_dynsout = MakeSymbol("dyn_out~");
+ sym_dynin = MakeSymbol("dyn_in");
+ sym_dynout = MakeSymbol("dyn_out");
+
+ sym_dot = MakeSymbol(".");
+ sym_dyncanvas = MakeSymbol(" dyn~-canvas ");
+
// set up proxy class for inbound messages
! pxin_class = class_new(const_cast<t_symbol *>(sym_dynin),(t_newmethod)pxin_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
add_anything(pxin_class,proxyin::px_method);
// set up proxy class for inbound signals
! pxins_class = class_new(const_cast<t_symbol *>(sym_dynsin),(t_newmethod)pxins_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
add_dsp(pxins_class,proxyin::dsp);
CLASS_MAINSIGNALIN(pxins_class, proxyin, defsig);
// set up proxy class for outbound messages
! pxout_class = class_new(const_cast<t_symbol *>(sym_dynout),(t_newmethod)pxout_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
add_anything(pxout_class,proxyout::px_method);
// set up proxy class for outbound signals
! pxouts_class = class_new(const_cast<t_symbol *>(sym_dynsout),(t_newmethod)pxouts_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
add_dsp(pxouts_class,proxyout::dsp);
CLASS_MAINSIGNALIN(pxouts_class, proxyout, defsig);
***************
*** 220,223 ****
--- 242,249 ----
k_msg = MakeSymbol("msg");
k_text = MakeSymbol("text");
+
+ sym_vis = MakeSymbol("vis");
+ sym_loadbang = MakeSymbol("loadbang");
+ sym_dsp = MakeSymbol("dsp");
}
***************
*** 280,284 ****
SetInt(arg[2],700); // xwidth
SetInt(arg[3],520); // xwidth
! SetString(arg[4]," dyn~-canvas "); // canvas name
SetInt(arg[5],0); // visible
--- 306,310 ----
SetInt(arg[2],700); // xwidth
SetInt(arg[3],520); // xwidth
! SetSymbol(arg[4],sym_dyncanvas); // canvas name
SetInt(arg[5],0); // visible
***************
*** 296,302 ****
SetInt(lst[0],i*100);
SetInt(lst[1],10);
! SetString(lst[2],".");
! SetString(lst[3],"");
! SetString(lst[4],sig?"dyn_in~":"dyn_in");
try {
--- 322,328 ----
SetInt(lst[0],i*100);
SetInt(lst[1],10);
! SetSymbol(lst[2],sym_dot);
! SetSymbol(lst[3],sym__);
! SetSymbol(lst[4],sig?sym_dynsin:sym_dynin);
try {
***************
*** 318,324 ****
SetInt(lst[0],i*100);
SetInt(lst[1],500);
! SetString(lst[2],".");
! SetString(lst[3],"");
! SetString(lst[4],sig?"dyn_out~":"dyn_out");
try {
--- 344,350 ----
SetInt(lst[0],i*100);
SetInt(lst[1],500);
! SetSymbol(lst[2],sym_dot);
! SetSymbol(lst[3],sym__);
! SetSymbol(lst[4],sig?sym_dynsout:sym_dynout);
try {
***************
*** 361,365 ****
t_glist *dyn::FindCanvas(const t_symbol *n)
{
! if(n == MakeSymbol("."))
return canvas;
else {
--- 387,391 ----
t_glist *dyn::FindCanvas(const t_symbol *n)
{
! if(n == sym_dot)
return canvas;
else {
***************
*** 386,391 ****
static t_gobj *GetLast(t_glist *gl)
{
! t_gobj *go;
! for (go = gl->gl_list; go->g_next; go = go->g_next);
return go;
}
--- 412,419 ----
static t_gobj *GetLast(t_glist *gl)
{
! t_gobj *go = gl->gl_list;
! if(go)
! while(go->g_next)
! go = go->g_next;
return go;
}
***************
*** 423,427 ****
if(argv) {
! if(add && (!name || name == MakeSymbol(".") || Find(name)))
err = "Object name is already present";
else if(!canv || !(glist = FindCanvas(canv)))
--- 451,455 ----
if(argv) {
! if(add && (!name || name == sym_dot || Find(name)))
err = "Object name is already present";
else if(!canv || !(glist = FindCanvas(canv)))
***************
*** 431,452 ****
canvas_setcurrent(glist);
! pd_typedmess((t_pd *)glist,(t_symbol *)kind,argc,(t_atom *)argv);
if(kind == k_obj) {
t_object *o = (t_object *)pd_newest();
- newest = o?&o->te_g:NULL;
! if(!newest) {
// PD creates a text object when the intended object could not be created
t_gobj *trash = GetLast(glist);
! // TODO: Test for it....
!
! // Delete it!
! Delete(trash);
}
}
- else
- newest = GetLast(glist);
// look for latest created object
--- 459,483 ----
canvas_setcurrent(glist);
! t_gobj *last = GetLast(glist);
! pd_typedmess((t_pd *)glist,(t_symbol *)kind,argc,argv);
! newest = GetLast(glist);
if(kind == k_obj) {
t_object *o = (t_object *)pd_newest();
! if(!o) {
// PD creates a text object when the intended object could not be created
t_gobj *trash = GetLast(glist);
! // Test for newly created object....
! if(trash && last != trash) {
! // Delete it!
! glist_delete(glist,trash);
! }
! newest = NULL;
}
+ else
+ newest = &o->te_g;
}
// look for latest created object
***************
*** 458,465 ****
if(pd_class(&newest->g_pd) == canvas_class) {
// hide the sub-canvas
! pd_vmess((t_pd *)newest,gensym("vis"),"i",0);
// loadbang the abstraction
! pd_vmess((t_pd *)newest,gensym("loadbang"),"");
}
--- 489,496 ----
if(pd_class(&newest->g_pd) == canvas_class) {
// hide the sub-canvas
! pd_vmess((t_pd *)newest,const_cast<t_symbol *>(sym_vis),"i",0);
// loadbang the abstraction
! pd_vmess((t_pd *)newest,const_cast<t_symbol *>(sym_loadbang),"");
}
***************
*** 728,732 ****
{
// add sub canvas to dsp list (no signal vector to borrow from .. set it to NULL)
! mess1((t_pd *)canvas, gensym("dsp"),NULL);
flext_dsp::m_dsp(n,insigs,outsigs);
--- 759,763 ----
{
// add sub canvas to dsp list (no signal vector to borrow from .. set it to NULL)
! mess1((t_pd *)canvas,const_cast<t_symbol *>(sym_dsp),NULL);
flext_dsp::m_dsp(n,insigs,outsigs);