summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-11-24 10:05:19 +0100
committerjmoenig <jens@moenig.org>2014-11-24 10:05:19 +0100
commit927448d7ab4f7069661eb73018463fbf0e40651a (patch)
tree5b20b0ce784dcf4ba7e68ade3ae280b8b1b6f8b8
parent8814b61a323a2fb554cf1869f6a7b8ab06009764 (diff)
downloadsnap-927448d7ab4f7069661eb73018463fbf0e40651a.tar.gz
snap-927448d7ab4f7069661eb73018463fbf0e40651a.zip
Fixed #416
-rwxr-xr-xhistory.txt1
-rw-r--r--objects.js50
2 files changed, 32 insertions, 19 deletions
diff --git a/history.txt b/history.txt
index 4d17e3e..9d977ad 100755
--- a/history.txt
+++ b/history.txt
@@ -2345,4 +2345,5 @@ ______
1411214
-------
* Threads: Fixed #318
+* Objects: Fixed #416
diff --git a/objects.js b/objects.js
index 4be213a..3b2c07b 100644
--- a/objects.js
+++ b/objects.js
@@ -125,7 +125,7 @@ PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.objects = '2014-October-08';
+modules.objects = '2014-November-24';
var SpriteMorph;
var StageMorph;
@@ -1674,6 +1674,20 @@ SpriteMorph.prototype.blockTemplates = function (category) {
return menu;
}
+ function addVar(pair) {
+ if (pair) {
+ if (myself.variables.silentFind(pair[0])) {
+ myself.inform('that name is already in use');
+ } else {
+ myself.addVariable(pair[0], pair[1]);
+ myself.toggleVariableWatcher(pair[0], pair[1]);
+ myself.blocksCache[cat] = null;
+ myself.paletteCache[cat] = null;
+ myself.parentThatIsA(IDE_Morph).refreshPalette();
+ }
+ }
+ }
+
if (cat === 'motion') {
blocks.push(block('forward'));
@@ -1967,15 +1981,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
function () {
new VariableDialogMorph(
null,
- function (pair) {
- if (pair && !myself.variables.silentFind(pair[0])) {
- myself.addVariable(pair[0], pair[1]);
- myself.toggleVariableWatcher(pair[0], pair[1]);
- myself.blocksCache[cat] = null;
- myself.paletteCache[cat] = null;
- myself.parentThatIsA(IDE_Morph).refreshPalette();
- }
- },
+ addVar,
myself
).prompt(
'Variable name',
@@ -4858,6 +4864,20 @@ StageMorph.prototype.blockTemplates = function (category) {
);
}
+ function addVar(pair) {
+ if (pair) {
+ if (myself.variables.silentFind(pair[0])) {
+ myself.inform('that name is already in use');
+ } else {
+ myself.addVariable(pair[0], pair[1]);
+ myself.toggleVariableWatcher(pair[0], pair[1]);
+ myself.blocksCache[cat] = null;
+ myself.paletteCache[cat] = null;
+ myself.parentThatIsA(IDE_Morph).refreshPalette();
+ }
+ }
+ }
+
if (cat === 'motion') {
txt = new TextMorph(localize(
@@ -5099,15 +5119,7 @@ StageMorph.prototype.blockTemplates = function (category) {
function () {
new VariableDialogMorph(
null,
- function (pair) {
- if (pair && !myself.variables.silentFind(pair[0])) {
- myself.addVariable(pair[0], pair[1]);
- myself.toggleVariableWatcher(pair[0], pair[1]);
- myself.blocksCache[cat] = null;
- myself.paletteCache[cat] = null;
- myself.parentThatIsA(IDE_Morph).refreshPalette();
- }
- },
+ addVar,
myself
).prompt(
'Variable name',