pull/3/merge
jmoenig 2014-11-24 10:05:19 +01:00
rodzic 8814b61a32
commit 927448d7ab
2 zmienionych plików z 32 dodań i 19 usunięć

Wyświetl plik

@ -2345,4 +2345,5 @@ ______
1411214
-------
* Threads: Fixed #318
* Objects: Fixed #416

Wyświetl plik

@ -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',