summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-02-04 14:45:15 +0100
committerjmoenig <jens@moenig.org>2014-02-04 14:45:15 +0100
commit9be9d3da11461f218108eb3375875e6363208a7b (patch)
tree05fef43977e12cbfe78f47da67d0ede928ab201c
parent1d8862c7af97408679aa431431a369197b2e47d1 (diff)
downloadsnap-yow-9be9d3da11461f218108eb3375875e6363208a7b.tar.gz
snap-yow-9be9d3da11461f218108eb3375875e6363208a7b.zip
Import sounds from the project menu
Thanks, Brian, for the changeset!
-rw-r--r--gui.js28
-rwxr-xr-xhistory.txt3
2 files changed, 29 insertions, 2 deletions
diff --git a/gui.js b/gui.js
index 1943636..96903a0 100644
--- a/gui.js
+++ b/gui.js
@@ -64,7 +64,7 @@ standardSettings, Sound, BlockMorph, ToggleMorph, InputSlotDialogMorph,
ScriptsMorph, isNil, SymbolMorph, BlockExportDialogMorph,
BlockImportDialogMorph, SnapTranslator, localize, List, InputSlotMorph,
SnapCloud, Uint8Array, HandleMorph, SVG_Costume, fontHeight, hex_sha512,
-sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph*/
+sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio*/
// Global stuff ////////////////////////////////////////////////////////
@@ -2415,6 +2415,32 @@ IDE_Morph.prototype.projectMenu = function () {
},
'Select a costume from the media library'
);
+ menu.addItem(
+ localize('Sounds') + '...',
+ function () {
+ var names = this.getCostumesList('Sounds'),
+ libMenu = new MenuMorph(this, 'Import sound');
+
+ function loadSound(name) {
+ var url = 'Sounds/' + name,
+ audio = new Audio();
+ audio.src = url;
+ audio.load();
+ myself.droppedAudio(audio, name);
+ }
+
+ names.forEach(function (line) {
+ if (line.length > 0) {
+ libMenu.addItem(
+ line,
+ function () {loadSound(line); }
+ );
+ }
+ });
+ libMenu.popup(world, pos);
+ },
+ 'Select a sound from the media library'
+ );
menu.popup(world, pos);
};
diff --git a/history.txt b/history.txt
index d1fea7e..577e17a 100755
--- a/history.txt
+++ b/history.txt
@@ -2078,4 +2078,5 @@ ______
140204
------
-* GUI: Import costumes and background from the project menu, thanks, Brian, for the changeset!
+* GUI: Import costumes and backgrounds from the project menu, thanks, Brian, for the changeset!
+* GUI: Import sounds from the project menu, thanks, Brian, for the changeset!