Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17930
Modified Files: Tag: desiredata x_gui.c desire.tk Log Message: 0.40: openpanel, savepanel
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.42 retrieving revision 1.1.2.600.2.43 diff -C2 -d -r1.1.2.600.2.42 -r1.1.2.600.2.43 *** desire.tk 8 Dec 2006 02:41:36 -0000 1.1.2.600.2.42 --- desire.tk 8 Dec 2006 09:35:30 -0000 1.1.2.600.2.43 *************** *** 7425,7428 **** --- 7425,7452 ----
#---------------------------------------------------------------- + # openpanel & savepanel + + proc pdtk_openpanel {target localdir} { + if {$localdir == ""} {set localdir $::pd_opendir} + set filename [tk_getOpenFile -initialdir $localdir] + if {$filename != ""} { + set directory [string range $filename 0 [expr [string last / $filename]-1]] + set pd_opendir $directory + netsend [list $target callback [pdtk_enquote $filename]] + } + } + + proc pdtk_savepanel {target localdir} { + if {$localdir == ""} { + set filename [tk_getSaveFile] + } else { + set filename [tk_getSaveFile -initialdir $localdir] + } + if {$filename != ""} { + netsend [list $target callback [pdtk_enquote $filename]] + } + } + + #---------------------------------------------------------------- # To err is human.
Index: x_gui.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/x_gui.c,v retrieving revision 1.3.4.1.2.5 retrieving revision 1.3.4.1.2.5.2.1 diff -C2 -d -r1.3.4.1.2.5 -r1.3.4.1.2.5.2.1 *** x_gui.c 30 Nov 2005 13:36:58 -0000 1.3.4.1.2.5 --- x_gui.c 8 Dec 2006 09:35:30 -0000 1.3.4.1.2.5.2.1 *************** *** 212,215 **** --- 212,221 ---- static void openpanel_symbol(t_openpanel *x, t_symbol *s) { + char *path = (s && s->s_name) ? s->s_name : """"; + sys_vgui("pdtk_openpanel {%s} {%s}\n", x->x_s->s_name, path); + } + + static void openpanel_callback(t_openpanel *x, t_symbol *s) + { outlet_symbol(x->x_obj.ob_outlet, s); } *************** *** 231,234 **** --- 237,241 ---- class_addbang(openpanel_class, openpanel_bang); class_addmethod(openpanel_class, (t_method)openpanel_path, gensym("path"), A_SYMBOL, 0); + class_addmethod(openpanel_class, (t_method)openpanel_callback, gensym("callback"), A_SYMBOL, 0); class_addsymbol(openpanel_class, openpanel_symbol); } *************** *** 259,268 **** static void savepanel_bang(t_savepanel *x) { ! const char*path=(x->x_path&&x->x_path->s_name)?x->x_path->s_name:""""; ! sys_vgui("pdtk_savepanel {%s} {%s}\n", x->x_s->s_name, path); }
static void savepanel_symbol(t_savepanel *x, t_symbol *s) { outlet_symbol(x->x_obj.ob_outlet, s); } --- 266,283 ---- static void savepanel_bang(t_savepanel *x) { ! const char*path=(x->x_path&&x->x_path->s_name)?x->x_path->s_name:""""; ! sys_vgui("pdtk_savepanel {%s} {%s}\n", x->x_s->s_name, path); }
static void savepanel_symbol(t_savepanel *x, t_symbol *s) { + // x->x_path = s; + // savepanel_bang(x); + char *path = (s && s->s_name) ? s->s_name : """"; + sys_vgui("pdtk_savepanel {%s} {%s}\n", x->x_s->s_name, path); + } + + static void savepanel_callback(t_savepanel *x, t_symbol *s) + { outlet_symbol(x->x_obj.ob_outlet, s); } *************** *** 280,283 **** --- 295,299 ---- class_addbang(savepanel_class, savepanel_bang); class_addmethod(savepanel_class, (t_method)openpanel_path, gensym("path"), A_SYMBOL, 0); + class_addmethod(savepanel_class, (t_method)savepanel_callback, gensym("callback"), A_SYMBOL, 0); class_addsymbol(savepanel_class, savepanel_symbol); }