diff --git a/pd/nw/dialog_canvas.html b/pd/nw/dialog_canvas.html index 4b82396d2097be010d2e19dfb0f31108c29700ec..3952adc789b0ec18b434dc49169dd04fa2bc815b 100644 --- a/pd/nw/dialog_canvas.html +++ b/pd/nw/dialog_canvas.html @@ -519,13 +519,13 @@ function cancel() { } } -function resize_window() { - var w = document.body.scrollWidth, - h = document.body.scrollHeight, - win = pdgui.get_dialogwin(pd_object_callback); - win.width = w; - win.height = h; -} +//function resize_window() { +// var w = document.body.scrollWidth, +// h = document.body.scrollHeight, +// win = pdgui.get_dialogwin(pd_object_callback); +// win.width = w; +// win.height = h; +//} function populate_array_form(arrays) { var arrays_select, a_field = document.getElementById('arrays'); @@ -593,7 +593,7 @@ function register_canvas_id(gfxstub, attr_arrays) { // labels and form elements. That makes it more efficient and // snappier, at least on older machines. document.getElementsByClassName('container')[0].style.setProperty('display', 'inline'); - resize_window(); + pdgui.resize_window(pd_object_callback); } function tr_text(id) { diff --git a/pd/nw/dialog_gatom.html b/pd/nw/dialog_gatom.html index 98ea08a67b7a1f85c89d3fdd6c369cfe9f00a53a..addb4d23897cff623ffd724b24053b6a1250ad99 100644 --- a/pd/nw/dialog_gatom.html +++ b/pd/nw/dialog_gatom.html @@ -224,6 +224,7 @@ function register_canvas_id(gfxstub, attr_array) { // snappier, at least on older machines. document.getElementsByClassName('container')[0] .style.setProperty('display', 'inline'); + pdgui.resize_window(pd_object_callback); } function tr_text(id) { diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html index ddcc79e8a98e9758d144657ed268a214c235990a..1e83d7469c8fdfd03808d2296c4ad0c3d4702533 100644 --- a/pd/nw/dialog_iemgui.html +++ b/pd/nw/dialog_iemgui.html @@ -476,13 +476,13 @@ function cancel() { pdgui.pdsend(pd_object_callback + " cancel"); } -function resize_window() { - var w = document.body.scrollWidth, - h = document.body.scrollHeight, - win = pdgui.get_dialogwin(pd_object_callback); - win.width = w; - win.height = h; -} +//function resize_window() { +// var w = document.body.scrollWidth, +// h = document.body.scrollHeight, +// win = pdgui.get_dialogwin(pd_object_callback); +// win.width = w; +// win.height = h; +//} // 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 @@ -504,7 +504,7 @@ function register_canvas_id(gfxstub, attr_array) { // labels and form elements. That makes it more efficient and // snappier, at least on older machines. document.getElementsByClassName('container')[0].style.setProperty('display', 'inline'); - resize_window(); + pdgui.resize_window(pd_object_callback); } function tr_text(id) { diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html index 59a59c3ccb9ac80d79f5984be35042c761d00b70..4a19b6083ea5b66f2157af57d4b1eaf763f891d5 100644 --- a/pd/nw/dialog_prefs.html +++ b/pd/nw/dialog_prefs.html @@ -399,14 +399,14 @@ function cancel() { //pdgui.pdsend(pd_object_callback + " cancel"); } -function resize_window() { - var w = document.body.scrollWidth, - h = document.body.scrollHeight, - win = pdgui.get_dialogwin(pd_object_callback); - win.width = w; - win.height = h; -pdgui.gui_post("w is " + w + " and h is " + h); -} +//function resize_window() { +// var w = document.body.scrollWidth, +// h = document.body.scrollHeight, +// win = pdgui.get_dialogwin(pd_object_callback); +// win.width = w; +// win.height = h; +//pdgui.gui_post("w is " + w + " and h is " + h); +//} function change_api(elem) { var id = elem.getAttribute('id'), @@ -530,7 +530,8 @@ function audio_prefs_callback(attrs) { // have the side-effect of setting the dev to 'None') set_chans('in', get_attr('pd-inchans', attrs)); set_chans('out', get_attr('pd-outchans', attrs)); - resize_window(); + + pdgui.resize_window(pd_object_callback); } function set_devs(type, devs) { @@ -564,7 +565,8 @@ function midi_prefs_callback(attrs) { get_attr('current-api', attrs) ); } - resize_window(); + + pdgui.resize_window(pd_object_callback); } diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index d419763b15904d773440d459caa9214b0240aadb..7ff651541eb567a4da6f280764f6901fea6fbb1d 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3524,7 +3524,7 @@ gui_post("did is " + did + " and dialogwin[did] is " + dialogwin[did]); function gui_font_dialog(cid, gfxstub, font_size) { var attrs = { canvas: cid, font_size: font_size }; - dialogwin[gfxstub] = nw_create_window(gfxstub, 'font', 265, 540, 20, 20, 0, + dialogwin[gfxstub] = nw_create_window(gfxstub, 'font', 265, 265, 20, 20, 0, 0, 1, 'white', 'Properties', '', 0, null, attrs); } @@ -3840,3 +3840,10 @@ exports.dialog_bindings = function(did) { } }; } + +exports.resize_window = function(did) { + var w = dialogwin[did].window.document.body.scrollWidth, + h = dialogwin[did].window.document.body.scrollHeight; + dialogwin[did].width = w; + dialogwin[did].height = h; +}