On Thursday, October 27, 2011 4:43 PM, "Martin Peach" martin.peach@sympatico.ca wrote:
On 2011-10-12 12:43, Hans-Christoph Steiner wrote:
Now that pdlua and tclpd are officially part of Pd-extended, I just had a little thought/feature request to make working with those objects easier. It would be very nice if you could right-click on the object, and click "Open" and have Pd open the script file in the associated editor. You can do this on all platforms using:
::pd_menucommands::menu_openfile {filename}
Or at least use that as example code for how to do it.
I have just got that working for pdlua in svn. Some notes:
A class must have a menu-open method before the Open item will be highlighted:
class_addmethod(our_class, (t_method)our_menu_open, gensym("menu-open"), A_NULL);
and the method itself:
static void our_menu_open(t_our_class *x)
calls sys_vgui("::pd_menucommands::menu_openfile {%s}\n", filename);
So the object needs to know the name of its script. For pdlua I added a field "_scriptname" in the lua side with an accessor "_whoami".
Martin
Ah, that's cool! That's cleaner than I thought it'd be, I thought it'd be some kind of ugly hack.
It would be really awesome if you could edit the file and have the object automatically updated. That would be a lot harder. I suppose using the file alteration monitor stuff in GNU/Linux and Mac OS X, you could efficiently get notification whether the file changed, but polling might not be so bad. I guess the hard part would be re-registering the object with Pd.
.hc