Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18986
Modified Files:
Tag: devel_0_39
u_main.tk x_gui.c
Log Message:
[ 1244757 ] {open,save}panel with settable path
Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.4.4.10.2.9
retrieving revision 1.4.4.10.2.10
diff -C2 -d -r1.4.4.10.2.9 -r1.4.4.10.2.10
*** u_main.tk 21 Aug 2005 11:28:24 -0000 1.4.4.10.2.9
--- u_main.tk 4 Oct 2005 22:35:08 -0000 1.4.4.10.2.10
***************
*** 3387,3394 ****
############# open and save dialogs for objects in Pd ##########
! proc pdtk_openpanel {target} {
global pd_opendir
set filename [tk_getOpenFile \
! -initialdir $pd_opendir]
if {$filename != ""} {
set directory [string range $filename 0 \
--- 3387,3398 ----
############# open and save dialogs for objects in Pd ##########
! proc pdtk_openpanel {target localdir} {
global pd_opendir
+ if {$localdir == ""} {
+ set localdir $pd_opendir
+ }
+
set filename [tk_getOpenFile \
! -initialdir $localdir ]
if {$filename != ""} {
set directory [string range $filename 0 \
***************
*** 3400,3405 ****
}
! proc pdtk_savepanel {target} {
! set filename [tk_getSaveFile]
if {$filename != ""} {
pd [concat $target symbol [pdtk_enquote $filename] \;]
--- 3404,3409 ----
}
! proc pdtk_savepanel {target localdir} {
! set filename [tk_getSaveFile -initialdir $localdir]
if {$filename != ""} {
pd [concat $target symbol [pdtk_enquote $filename] \;]
Index: x_gui.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/x_gui.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.1.2.1
diff -C2 -d -r1.3.4.1 -r1.3.4.1.2.1
*** x_gui.c 11 May 2005 20:07:00 -0000 1.3.4.1
--- x_gui.c 4 Oct 2005 22:35:08 -0000 1.3.4.1.2.1
***************
*** 189,195 ****
t_object x_obj;
t_symbol *x_s;
} t_openpanel;
! static void *openpanel_new(void)
{
char buf[50];
--- 189,196 ----
t_object x_obj;
t_symbol *x_s;
+ t_symbol *x_path;
} t_openpanel;
! static void *openpanel_new(t_symbol*s)
{
char buf[50];
***************
*** 197,200 ****
--- 198,202 ----
sprintf(buf, "d%lx", (t_int)x);
x->x_s = gensym(buf);
+ x->x_path=s;
pd_bind(&x->x_obj.ob_pd, x->x_s);
outlet_new(&x->x_obj, &s_symbol);
***************
*** 204,208 ****
static void openpanel_bang(t_openpanel *x)
{
! sys_vgui("pdtk_openpanel %s\n", x->x_s->s_name);
}
--- 206,211 ----
static void openpanel_bang(t_openpanel *x)
{
! char*path=(x->x_path&&x->x_path->s_name)?x->x_path->s_name:"\"\"";
! sys_vgui("pdtk_openpanel {%s} {%s}\n", x->x_s->s_name, path);
}
***************
*** 211,214 ****
--- 214,221 ----
outlet_symbol(x->x_obj.ob_outlet, s);
}
+ static void openpanel_path(t_openpanel *x, t_symbol *s)
+ {
+ x->x_path=s;
+ }
static void openpanel_free(t_openpanel *x)
***************
*** 221,226 ****
openpanel_class = class_new(gensym("openpanel"),
(t_newmethod)openpanel_new, (t_method)openpanel_free,
! sizeof(t_openpanel), 0, A_DEFFLOAT, 0);
class_addbang(openpanel_class, openpanel_bang);
class_addsymbol(openpanel_class, openpanel_symbol);
}
--- 228,234 ----
openpanel_class = class_new(gensym("openpanel"),
(t_newmethod)openpanel_new, (t_method)openpanel_free,
! sizeof(t_openpanel), 0, A_DEFSYM, 0);
class_addbang(openpanel_class, openpanel_bang);
+ class_addmethod(openpanel_class, (t_method)openpanel_path, gensym("path"), A_SYMBOL);
class_addsymbol(openpanel_class, openpanel_symbol);
}
***************
*** 234,240 ****
t_object x_obj;
t_symbol *x_s;
} t_savepanel;
! static void *savepanel_new(void)
{
char buf[50];
--- 242,249 ----
t_object x_obj;
t_symbol *x_s;
+ t_symbol *x_path;
} t_savepanel;
! static void *savepanel_new(t_symbol*s)
{
char buf[50];
***************
*** 242,245 ****
--- 251,255 ----
sprintf(buf, "d%lx", (t_int)x);
x->x_s = gensym(buf);
+ x->x_path=s;
pd_bind(&x->x_obj.ob_pd, x->x_s);
outlet_new(&x->x_obj, &s_symbol);
***************
*** 249,253 ****
static void savepanel_bang(t_savepanel *x)
{
! sys_vgui("pdtk_savepanel %s\n", x->x_s->s_name);
}
--- 259,264 ----
static void savepanel_bang(t_savepanel *x)
{
! 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);
}
***************
*** 266,271 ****
savepanel_class = class_new(gensym("savepanel"),
(t_newmethod)savepanel_new, (t_method)savepanel_free,
! sizeof(t_savepanel), 0, A_DEFFLOAT, 0);
class_addbang(savepanel_class, savepanel_bang);
class_addsymbol(savepanel_class, savepanel_symbol);
}
--- 277,283 ----
savepanel_class = class_new(gensym("savepanel"),
(t_newmethod)savepanel_new, (t_method)savepanel_free,
! sizeof(t_savepanel), 0, A_DEFSYM, 0);
class_addbang(savepanel_class, savepanel_bang);
+ class_addmethod(savepanel_class, (t_method)openpanel_path, gensym("path"), A_SYMBOL);
class_addsymbol(savepanel_class, savepanel_symbol);
}