[PD-dev] adding an "Open" method to pdlua and tclpd

Martin Peach martin.peach at sympatico.ca
Thu Oct 27 22:43:31 CEST 2011


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



More information about the Pd-dev mailing list