Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Aayush
purr-data
Commits
3bc84155
Commit
3bc84155
authored
Dec 05, 2015
by
Jonathan Wilkes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug with menu_open not getting triggered from a canvas window
parent
bc85bd22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
14 deletions
+32
-14
pd/nw/index.js
pd/nw/index.js
+2
-0
pd/nw/pd_canvas.html
pd/nw/pd_canvas.html
+2
-2
pd/nw/pd_canvas.js
pd/nw/pd_canvas.js
+28
-12
No files found.
pd/nw/index.js
View file @
3bc84155
...
...
@@ -381,6 +381,8 @@ function nw_create_pd_window_menus(gui, w) {
});
span
.
innerHTML
=
input
;
var
chooser
=
w
.
document
.
querySelector
(
"
#fileDialog
"
);
// Hack-- we have to set the event listener here because we
// changed out the innerHTML above
chooser
.
onchange
=
function
()
{
var
file_array
=
this
.
value
;
// reset value so that we can open the same file twice
...
...
pd/nw/pd_canvas.html
View file @
3bc84155
...
...
@@ -5,10 +5,10 @@
type=
"text/css"
href=
"css/default.css"
>
</head>
<body
id=
"patch_body"
>
<span
id =
fileDialogSpan
>
<span
id =
"
fileDialogSpan
"
>
<input
style=
"display:none;"
id=
"fileDialog"
type=
"file"
multiple
/>
</span>
<span
id =
saveDialogSpan
>
<span
id =
"
saveDialogSpan
"
>
<input
style=
"display:none;"
id=
"saveDialog"
type=
"file"
nwsaveas
nwworkingdir
accept=
".pd"
/>
</span>
...
...
pd/nw/pd_canvas.js
View file @
3bc84155
...
...
@@ -376,18 +376,23 @@ var canvas_events = (function() {
pdgui
.
saveas_callback
(
name
,
this
.
value
);
// reset value so that we can open the same file twice
this
.
value
=
null
;
console
.
log
(
"
tried to open something
"
);
},
false
);
document
.
querySelector
(
"
#fileDialog
"
).
addEventListener
(
"
change
"
,
function
(
evt
)
{
var
file_array
=
this
.
value
;
// reset value so that we can open the same file twice
this
.
value
=
null
;
pdgui
.
menu_open
(
file_array
);
console
.
log
(
"
tried to open something
"
);
console
.
log
(
"
tried to save something
"
);
},
false
);
// The following is commented out because we have to set the
// event listener inside nw_create_pd_window_menus due to a
// bug with nwworkingdir
//document.querySelector("#fileDialog").addEventListener("change",
// function(evt) {
// var file_array = this.value;
// // reset value so that we can open the same file twice
// this.value = null;
// pdgui.menu_open(file_array);
// console.log("tried to open something\n\n\n\n\n\n\n\n");
// }, false
//);
document
.
querySelector
(
"
#openpanel_dialog
"
).
addEventListener
(
"
change
"
,
function
(
evt
)
{
var
file_string
=
this
.
value
;
...
...
@@ -663,13 +668,24 @@ function nw_create_patch_window_menus(gui, w, name) {
var
input
,
chooser
,
span
=
w
.
document
.
querySelector
(
"
#fileDialogSpan
"
);
input
=
pdgui
.
build_file_dialog_string
({
id
:
"
fileDialog
"
,
nwworkingdir
:
"
/user/home
"
,
style
:
"
display: none;
"
,
type
:
"
file
"
,
id
:
"
fileDialog
"
,
nwworkingdir
:
"
/user/home
"
,
multiple
:
null
,
accept
:
"
.pd,.pat,.mxt,.mxb,.help
"
});
span
.
innerHTML
=
input
;
chooser
=
w
.
document
.
querySelector
(
"
#fileDialog
"
);
// Hack-- we have to set the event listener here because we
// changed out the innerHTML above
chooser
.
onchange
=
function
()
{
var
file_array
=
this
.
value
;
// reset value so that we can open the same file twice
this
.
value
=
null
;
pdgui
.
menu_open
(
file_array
);
console
.
log
(
"
tried to open something
"
);
};
chooser
.
click
();
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment