Hey Lorenzo,
I cc'ed pd-dev since this could be generally useful discussion. The
save thing works a fair amount different than open, and the messages are
hidden within the pd <-> pd-gui communications. The place to start in
finding the File->Save function is to look at what the File->Save or
Ctrl-S calls. In tcl/pd_bindings.tcl, you can see this:
bind all <$::modifier-Key-s> {menu_send %W menusave}
So Ctrl-S directly sends 'menusave' to pd. To find that in the C
source, I look for '"menusave"' i.e. menusave in double-quotes:
hans@palatschinken pure-data.git $ grep '"menusave"' src/*.c
src/g_readwrite.c: gensym("menusave"), 0);
Which is a piece of this line:
class_addmethod(canvas_class, (t_method)canvas_menusave,
gensym("menusave"), 0);
So that binds "menusave" to the canvas_menusave function which
ultimately replies to pd-gui calling the Tcl proc pdtk_canvas_saveas.
So you just need to override that Tcl proc since that is where
tk_getSaveFile is called to launch the Save As panel.
.hc
On Thu, 2011-03-31 at 23:35 +0200, Lorenzo Sutton wrote:
> Hans,
>
> I was looking into putting the save as well, but as hard as I looked I
> just can't find where the save is... I was expecting to find something
> like proc ::pd_menucommands::menu_save but it doesn't seem to be there.
> In 0.42 I hacked a proc called pdtk_canvas_saveas to have the gtk but I
> can't find any reference to that either
> Any clue?
>
> Lorenzo