Commit 673407ab authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port dialog window callbacks for 0.13, change register_canvas_id to register_window_id

parent 6639cbc1
......@@ -632,7 +632,7 @@ function init_arrays(attr_objects) {
// 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
function register_canvas_id(gfxstub, attr_objects) {
function register_window_id(gfxstub, attr_objects) {
pd_object_callback = gfxstub;
var canvas_fieldsets, i, prop;
// attr_objects[0]: canvas properties
......
......@@ -135,7 +135,7 @@ function cancel() {
// 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
function register_canvas_id(gfxstub, attrs) {
function register_window_id(gfxstub, attrs) {
pd_object_callback = gfxstub;
console.log("attrs are " + attrs.toString());
add_events(gfxstub);
......
......@@ -206,7 +206,7 @@ function cancel() {
// 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
function register_canvas_id(gfxstub, attributes) {
function register_window_id(gfxstub, attributes) {
pd_object_callback = gfxstub;
add_events(gfxstub);
translate_form();
......
......@@ -480,9 +480,8 @@ function cancel() {
// 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
function register_canvas_id(gfxstub, attr_object) {
function register_window_id(gfxstub, attr_object) {
pd_object_callback = gfxstub;
console.log("attr object is " + attr_object.toString());
add_events(gfxstub);
translate_form();
......
......@@ -562,7 +562,7 @@ function midi_prefs_callback(attrs) {
// 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
function register_canvas_id(gfxstub, attr_arrays) {
function register_window_id(gfxstub, attr_arrays) {
pd_object_callback = gfxstub;
add_events(gfxstub);
translate_form();
......
......@@ -302,7 +302,7 @@ function nw_create_window(cid, type, width, height, xpos, ypos, attr_array) {
var my_file =
type === "pd_canvas" ? "pd_canvas.html" : "dialog_" + type + ".html";
var eval_string = "register_canvas_id(" +
var eval_string = "register_window_id(" +
JSON.stringify(cid) + ", " +
JSON.stringify(attr_array) + ");";
gui.Window.open(my_file, {
......@@ -318,7 +318,11 @@ function nw_create_window(cid, type, width, height, xpos, ypos, attr_array) {
x: xpos,
y: ypos
}, function (new_win) {
if (type === "pd_canvas") {
pdgui.set_patchwin(cid, new_win);
} else {
pdgui.set_dialogwin(cid, new_win);
}
new_win.on("loaded", function() {
new_win.eval(null, eval_string);
});
......
......@@ -652,7 +652,7 @@ var canvas_events = (function() {
// This gets called from the nw_create_window function in index.html
// It provides us with our canvas id from the C side. Once we have it
// we can create the menu and register event callbacks
function register_canvas_id(cid, attr_array) {
function register_window_id(cid, attr_array) {
name = cid; // hack
// We create the window menus and popup menu before doing anything else
// to ensure that we don't try to set the svg size before these are done.
......
......@@ -812,6 +812,10 @@ exports.get_dialogwin = function(name) {
return dialogwin[name];
}
exports.set_dialogwin = function(did, win) {
dialogwin[did] = win;
}
exports.remove_dialogwin = function(name) {
dialogwin[name] = null;
}
......@@ -3171,7 +3175,7 @@ function gui_iemgui_dialog(did, attr_array) {
//for (var i = 0; i < attr_array.length; i++) {
// attr_array[i] = '"' + attr_array[i] + '"';
//}
dialogwin[did] = nw_create_window(did, "iemgui", 265, 450, 20, 20,
nw_create_window(did, "iemgui", 265, 450, 20, 20,
attr_array_to_object(attr_array));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment