diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html index f7cf0569854715f636ab6c5315ae8104e95e12dc..d1a669ceb2fb40cb1395e9f19b00a6a277c40a7f 100644 --- a/pd/nw/dialog_prefs.html +++ b/pd/nw/dialog_prefs.html @@ -702,6 +702,14 @@ function gui_prefs_callback(name) { } } +function path_prefs_callback(use_stdpath, verbose, path_array) { + pdgui.post("path callback: " + path_array.join("\n")); +} + +function lib_prefs_callback(defeat_rt, flag_string, lib_array) { + pdgui.post("lib callback: " + lib_array.join("\n")); +} + // This gets called from the nw_create_window function in index.html // It provides us with our window id from the C side. Once we have it // we can create the menu and register event callbacks @@ -720,6 +728,8 @@ function register_window_id(gfxstub, attr_arrays) { pdgui.pdsend("pd audio-properties"); // request audio pref attrs pdgui.pdsend("pd midi-properties"); // request midi pref attrs pdgui.pdsend("pd gui-properties"); // request saved gui properties + pdgui.pdsend("pd start-path-dialog"); // request default system paths + pdgui.pdsend("pd start-startup-dialog"); // request default loaded libs document.getElementsByClassName("container")[0].style.setProperty("display", "inline"); } diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 6792b491fae7cfaf3de0e1af5931454749aba617..dfc010884d484835885b5fba5e3d907ba21da5b8 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -4480,6 +4480,18 @@ function gui_gui_properties(dummy, name) { } } +function gui_path_properties(dummy, use_stdpath, verbose, path_array) { + if (dialogwin["prefs"] !== null) { + dialogwin["prefs"].window.path_prefs_callback(use_stdpath, verbose, path_array); + } +} + +function gui_lib_properties(dummy, defeat_rt, flag_string, lib_array) { + if (dialogwin["prefs"] !== null) { + dialogwin["prefs"].window.lib_prefs_callback(defeat_rt, flag_string, lib_array); + } +} + // Let's try a closure for gui skins var skin = exports.skin = (function () { var dir = "css/"; diff --git a/pd/src/s_path.c b/pd/src/s_path.c index 04ec7aa8caefd2ec64a8d57b38a63428ad0d1d73..83bab45a24208f48176c8916455250f60aaebbcc 100644 --- a/pd/src/s_path.c +++ b/pd/src/s_path.c @@ -772,11 +772,22 @@ void glob_start_path_dialog(t_pd *dummy) int i; t_namelist *nl; - sys_gui("global pd_path; set pd_path {}\n"); + //sys_gui("global pd_path; set pd_path {}\n"); + gui_start_vmess("gui_path_properties", "xii", + dummy, + sys_usestdpath, + sys_verbose + ); + gui_start_array(); for (nl = sys_searchpath, i = 0; nl; nl = nl->nl_next, i++) - sys_vgui("lappend pd_path {%s}\n", nl->nl_string); - sprintf(buf, "pdtk_path_dialog %%s %d %d\n", sys_usestdpath, sys_verbose); - gfxstub_new(&glob_pdobject, (void *)glob_start_path_dialog, buf); + { + //sys_vgui("lappend pd_path {%s}\n", nl->nl_string); + gui_s(nl->nl_string); + } + gui_end_array(); + gui_end_vmess(); + //sprintf(buf, "pdtk_path_dialog %%s %d %d\n", sys_usestdpath, sys_verbose); + //gfxstub_new(&glob_pdobject, (void *)glob_start_path_dialog, buf); } /* new values from dialog window */ @@ -802,12 +813,23 @@ void glob_start_startup_dialog(t_pd *dummy) int i; t_namelist *nl; - sys_gui("global pd_startup; set pd_startup {}\n"); + //sys_gui("global pd_startup; set pd_startup {}\n"); + gui_start_vmess("gui_lib_properties", "xis", + dummy, + sys_defeatrt, + sys_flags->s_name + ); + gui_start_array(); for (nl = sys_externlist, i = 0; nl; nl = nl->nl_next, i++) - sys_vgui("lappend pd_startup {%s}\n", nl->nl_string); - sprintf(buf, "pdtk_startup_dialog %%s %d \"%s\"\n", sys_defeatrt, - sys_flags->s_name); - gfxstub_new(&glob_pdobject, (void *)glob_start_startup_dialog, buf); + { + //sys_vgui("lappend pd_startup {%s}\n", nl->nl_string); + gui_s(nl->nl_string); + } + gui_end_array(); + gui_end_vmess(); + //sprintf(buf, "pdtk_startup_dialog %%s %d \"%s\"\n", sys_defeatrt, + // sys_flags->s_name); + //gfxstub_new(&glob_pdobject, (void *)glob_start_startup_dialog, buf); } /* new values from dialog window */