summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
authorJohn <studej02@pf.jcu.cz>2014-08-03 11:16:34 +0200
committerGubolin <gubolin@fantasymail.de>2014-08-03 12:06:12 +0200
commitf267c27feb300319136e09234fd404df91bf8985 (patch)
tree42c2563fdb6be9f6a36d3b6cc667963ec57b88ae /gui.js
parenta44775e4624f1afd9b83ffa4061152bfde2b829f (diff)
downloadsnap-f267c27feb300319136e09234fd404df91bf8985.tar.gz
snap-f267c27feb300319136e09234fd404df91bf8985.zip
Update gui.js
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js47
1 files changed, 46 insertions, 1 deletions
diff --git a/gui.js b/gui.js
index 6af9137..1fe6047 100644
--- a/gui.js
+++ b/gui.js
@@ -212,6 +212,7 @@ IDE_Morph.prototype.init = function (isAutoFill) {
this.corral = null;
this.isAutoFill = isAutoFill || true;
+ this.isMuted = false;
this.isAppMode = false;
this.isSmallStage = false;
this.filePicker = null;
@@ -455,6 +456,7 @@ IDE_Morph.prototype.createControlBar = function () {
stopButton,
pauseButton,
startButton,
+ muteSoundsButton,
projectButton,
settingsButton,
stageSizeButton,
@@ -544,6 +546,38 @@ IDE_Morph.prototype.createControlBar = function () {
this.controlBar.add(appModeButton);
this.controlBar.appModeButton = appModeButton; // for refreshing
+ //muteSoundsButton
+ button = new ToggleButtonMorph(
+ null, //colors,
+ myself, // the IDE is the target
+ 'toggleMuteSounds',
+ [
+ new SymbolMorph('mutedSounds', 14),
+ new SymbolMorph('unmutedSounds', 14)
+ ],
+ function () { // query
+ return myself.isMuted;
+ }
+ );
+
+ button.corner = 12;
+ button.color = colors[0];
+ button.highlightColor = colors[1];
+ button.pressColor = colors[2];
+ button.labelMinExtent = new Point(36, 18);
+ button.padding = 0;
+ button.labelShadowOffset = new Point(-1, -1);
+ button.labelShadowColor = colors[1];
+ button.labelColor = this.buttonLabelColor;
+ button.contrast = this.buttonContrast;
+ button.drawNew();
+ // button.hint = 'sounds\nmuted & unmuted';
+ button.fixLayout();
+ button.refresh();
+ muteSoundsButton = button;
+ this.controlBar.add(muteSoundsButton);
+ this.controlBar.muteSoundsButton = button; // for refreshing
+
// stopButton
button = new PushButtonMorph(
this,
@@ -706,7 +740,7 @@ IDE_Morph.prototype.createControlBar = function () {
x = myself.right() - (StageMorph.prototype.dimensions.x
* (myself.isSmallStage ? myself.stageRatio : 1));
- [stageSizeButton, appModeButton].forEach(
+ [stageSizeButton, appModeButton, muteSoundsButton].forEach(
function (button) {
x += padding;
button.setCenter(myself.controlBar.center());
@@ -3369,6 +3403,17 @@ IDE_Morph.prototype.toggleStageSize = function (isSmall) {
}
};
+IDE_Morph.prototype.toggleMuteSounds = function (isMuted) {
+ this.isMuted = isNil(isMuted) ? !this.isMuted : isMuted;
+ this.controlBar.muteSoundsButton.refresh();
+
+ this.sprites.asArray().forEach(function (sprt) {
+ sprt.refreshVolumeOfAllActiveSounds();
+ });
+ this.stage.refreshVolumeOfAllActiveSounds();
+
+};
+
IDE_Morph.prototype.createNewProject = function () {
var myself = this;
this.confirm(