Import sounds from the project menu

Thanks, Brian, for the changeset!
pull/3/merge
jmoenig 2014-02-04 14:45:15 +01:00
rodzic 1d8862c7af
commit 9be9d3da11
2 zmienionych plików z 29 dodań i 2 usunięć

28
gui.js
Wyświetl plik

@ -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);
};

Wyświetl plik

@ -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!