From d8d1810e436cba83144f4b2234fc3097a739208b Mon Sep 17 00:00:00 2001 From: Hardmath123 Date: Sun, 22 Dec 2013 16:28:11 -0800 Subject: Initial stop others block --- threads.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'threads.js') diff --git a/threads.js b/threads.js index d1e57d3..25659b5 100644 --- a/threads.js +++ b/threads.js @@ -168,6 +168,17 @@ ThreadManager.prototype.stopAllForReceiver = function (rcvr) { }); }; +ThreadManager.prototype.stopAllForReceiverExcept = function (rcvr, excpt) { + this.processes.forEach(function (proc) { + if (proc.homeContext.receiver === rcvr && proc != excpt) { + proc.stop(); + if (rcvr.isClone) { + proc.isDead = true; + } + } + }); +}; + ThreadManager.prototype.stopProcess = function (block) { var active = this.findProcess(block); if (active) { @@ -1368,6 +1379,16 @@ Process.prototype.doStopAll = function () { } }; +Process.prototype.doStopOthers = function () { + var stage, ide; + if (this.homeContext.receiver) { + stage = this.homeContext.receiver.parentThatIsA(StageMorph); + if (stage) { + stage.threads.stopAllForReceiverExcept(this.homeContext.receiver, this); + } + } +}; + Process.prototype.doWarp = function (body) { // execute my contents block atomically (more or less) var outer = this.context.outerContext, // for tail call elimination -- cgit v1.3.1 From c947a4d5b741b783ebe6653929051ea03c34a590 Mon Sep 17 00:00:00 2001 From: blob8108 Date: Mon, 6 Jan 2014 11:17:59 +0000 Subject: Add useful headers to HTTP block --- threads.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'threads.js') diff --git a/threads.js b/threads.js index d1e57d3..9524d66 100644 --- a/threads.js +++ b/threads.js @@ -1730,6 +1730,9 @@ Process.prototype.reportURL = function (url) { if (!this.httpRequest) { this.httpRequest = new XMLHttpRequest(); this.httpRequest.open("GET", 'http://' + url, true); + this.httpRequest.setRequestHeader("X-Requested-With", + "XMLHttpRequest"); + this.httpRequest.setRequestHeader("X-Application", "Snap! 4.0"); this.httpRequest.send(null); } else if (this.httpRequest.readyState === 4) { response = this.httpRequest.responseText; -- cgit v1.3.1 From 8646dfc35ed3d11a2e23ecd545ecef47ef53f8b2 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 8 Jan 2014 12:18:04 +0100 Subject: support for TELL and ASK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The FOR reporter’s first input now also accepts blocks and scripts („rings“), and reports a copy that is bound to the sprite indicated by the second input. This lets you „zombify“ (or remote-control) sprites (and create custom TELL and ASK blocks) --- blocks.js | 3 +-- history.txt | 4 ++++ objects.js | 2 +- threads.js | 17 ++++++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) (limited to 'threads.js') diff --git a/blocks.js b/blocks.js index 96d8b53..619a487 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2013-November-26'; +modules.blocks = '2014-January-08'; var SyntaxElementMorph; var BlockMorph; @@ -996,7 +996,6 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { 'attributesMenu', true ); - part.isStatic = true; break; case '%fun': part = new InputSlotMorph( diff --git a/history.txt b/history.txt index 642ea7f..d205744 100755 --- a/history.txt +++ b/history.txt @@ -2044,3 +2044,7 @@ ______ ------ * Objects: stage watchers for „mouse x“ and „mouse y“ sensing reporters. Thanks, Michael! * Store: fixed saving/loading/localisation of new mouse coordinate stage watchers + +140108 +------ +* Threads, Blocks, Objects: The FOR reporter’s first input now also accepts blocks and scripts („rings“), and reports a copy that is bound to the sprite indicated by the second input. This lets you „zombify“ (or remote-control) sprites (and create custom TELL and ASK blocks) diff --git a/objects.js b/objects.js index 41b511d..67eb143 100644 --- a/objects.js +++ b/objects.js @@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2013-December-19'; +modules.objects = '2014-January-08'; var SpriteMorph; var StageMorph; diff --git a/threads.js b/threads.js index d1e57d3..19f5fd8 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-December-11'; +modules.threads = '2014-January-08'; var ThreadManager; var Process; @@ -2377,6 +2377,9 @@ Process.prototype.reportAttributeOf = function (attribute, name) { thatObj = this.getOtherObject(name, thisObj, stage); } if (thatObj) { + if (attribute instanceof Context) { + return this.reportContextFor(attribute, thatObj); + } if (isString(attribute)) { return thatObj.variables.getVar(attribute); } @@ -2401,6 +2404,18 @@ Process.prototype.reportAttributeOf = function (attribute, name) { return ''; }; +Process.prototype.reportContextFor = function (context, otherObj) { + // Private - return a copy of the context + // and bind it to another receiver + var result = copy(context); + result.receiver = otherObj; + if (result.outerContext) { + result.outerContext = copy(result.outerContext); + result.outerContext.receiver = otherObj; + } + return result; +}; + Process.prototype.reportMouseX = function () { var stage, world; if (this.homeContext.receiver) { -- cgit v1.3.1 From 1e959b8891df838b18c3bae40ba941c5f74df5cb Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 8 Jan 2014 17:51:34 +0100 Subject: fixed StopOthers blocks and added another option also updated the German translation --- blocks.js | 13 +++++++++++++ lang-de.js | 8 +++++++- locale.js | 4 ++-- objects.js | 3 ++- threads.js | 44 ++++++++++++++++++++++++++------------------ 5 files changed, 50 insertions(+), 22 deletions(-) (limited to 'threads.js') diff --git a/blocks.js b/blocks.js index 8b6bcc2..1ad2239 100644 --- a/blocks.js +++ b/blocks.js @@ -1037,6 +1037,19 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { ); part.setContents(['encode URI']); break; + case '%stopOthersChoices': + part = new InputSlotMorph( + null, + false, + { + 'all but this script' : ['all but this script'], + 'other scripts in sprite' : ['other scripts in sprite'] + }, + true + ); + part.setContents(['all but this script']); + part.isStatic = true; + break; case '%typ': part = new InputSlotMorph( null, diff --git a/lang-de.js b/lang-de.js index dec6092..1ed3f4f 100644 --- a/lang-de.js +++ b/lang-de.js @@ -185,7 +185,7 @@ SnapTranslator.dict.de = { 'translator_e-mail': 'jens@moenig.org', // optional 'last_changed': - '2013-10-04', // this, too, will appear in the Translators tab + '2018-01-08', // this, too, will appear in the Translators tab // GUI // control bar: @@ -453,6 +453,12 @@ SnapTranslator.dict.de = { 'stoppe dieses Skript', 'stop all %stop': 'stoppe alles %stop', + 'stop %stopOthersChoices': + 'stoppe %stopOthersChoices', + 'all but this script': + 'alles au\u00dfer diesem Skript', + 'other scripts in sprite': + 'andere Skripte in diesem Objekt', 'pause all %pause': 'pausiere alles %pause', 'run %cmdRing %inputs': diff --git a/locale.js b/locale.js index f894050..fd12371 100644 --- a/locale.js +++ b/locale.js @@ -42,7 +42,7 @@ /*global modules, contains*/ -modules.locale = '2013-December-04'; +modules.locale = '2014-January-08'; // Global stuff @@ -149,7 +149,7 @@ SnapTranslator.dict.de = { 'translator_e-mail': 'jens@moenig.org', 'last_changed': - '2013-10-04' + '2014-01-08' }; SnapTranslator.dict.it = { diff --git a/objects.js b/objects.js index fa9be12..9f892d4 100644 --- a/objects.js +++ b/objects.js @@ -594,7 +594,7 @@ SpriteMorph.prototype.initBlocks = function () { doStopOthers: { type: 'command', category: 'control', - spec: 'stop other scripts in sprite' + spec: 'stop %stopOthersChoices' }, doRun: { type: 'command', @@ -4361,6 +4361,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('doStopBlock')); blocks.push(block('doStop')); blocks.push(block('doStopAll')); + blocks.push(block('doStopOthers')); blocks.push('-'); blocks.push(block('doRun')); blocks.push(block('fork')); diff --git a/threads.js b/threads.js index 7d7b50a..8c3eb25 100644 --- a/threads.js +++ b/threads.js @@ -151,26 +151,19 @@ ThreadManager.prototype.startProcess = function (block, isThreadSafe) { return newProc; }; -ThreadManager.prototype.stopAll = function () { +ThreadManager.prototype.stopAll = function (excpt) { + // excpt is optional this.processes.forEach(function (proc) { - proc.stop(); - }); -}; - -ThreadManager.prototype.stopAllForReceiver = function (rcvr) { - this.processes.forEach(function (proc) { - if (proc.homeContext.receiver === rcvr) { + if (proc !== excpt) { proc.stop(); - if (rcvr.isClone) { - proc.isDead = true; - } } }); }; -ThreadManager.prototype.stopAllForReceiverExcept = function (rcvr, excpt) { +ThreadManager.prototype.stopAllForReceiver = function (rcvr, excpt) { + // excpt is optional this.processes.forEach(function (proc) { - if (proc.homeContext.receiver === rcvr && proc != excpt) { + if (proc.homeContext.receiver === rcvr && proc !== excpt) { proc.stop(); if (rcvr.isClone) { proc.isDead = true; @@ -1379,12 +1372,25 @@ Process.prototype.doStopAll = function () { } }; -Process.prototype.doStopOthers = function () { - var stage, ide; +Process.prototype.doStopOthers = function (choice) { + var stage; if (this.homeContext.receiver) { stage = this.homeContext.receiver.parentThatIsA(StageMorph); if (stage) { - stage.threads.stopAllForReceiverExcept(this.homeContext.receiver, this); + + switch (this.inputOption(choice)) { + case 'all but this script': + stage.threads.stopAll(this); + break; + case 'other scripts in sprite': + stage.threads.stopAllForReceiver( + this.homeContext.receiver, + this + ); + break; + default: + nop(); + } } } }; @@ -1751,8 +1757,10 @@ Process.prototype.reportURL = function (url) { if (!this.httpRequest) { this.httpRequest = new XMLHttpRequest(); this.httpRequest.open("GET", 'http://' + url, true); - this.httpRequest.setRequestHeader("X-Requested-With", - "XMLHttpRequest"); + this.httpRequest.setRequestHeader( + "X-Requested-With", + "XMLHttpRequest" + ); this.httpRequest.setRequestHeader("X-Application", "Snap! 4.0"); this.httpRequest.send(null); } else if (this.httpRequest.readyState === 4) { -- cgit v1.3.1 From 8a1ca3116b834625e6f71c6376c115975d4f9d75 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 9 Jan 2014 15:34:12 +0100 Subject: Collapse STOP primitives into a single block with a dropdown of options --- blocks.js | 17 ++++++++++++++++- history.txt | 5 +++++ objects.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++--------- threads.js | 19 +++++++++++++++++-- 4 files changed, 84 insertions(+), 12 deletions(-) (limited to 'threads.js') diff --git a/blocks.js b/blocks.js index 1ad2239..9997d70 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2014-January-08'; +modules.blocks = '2014-January-09'; var SyntaxElementMorph; var BlockMorph; @@ -1037,6 +1037,20 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { ); part.setContents(['encode URI']); break; + case '%stopChoices': + part = new InputSlotMorph( + null, + false, + { + 'all' : ['all'], + 'this script' : ['this script'], + 'this block' : ['this block'] + }, + true + ); + part.setContents(['all']); + part.isStatic = true; + break; case '%stopOthersChoices': part = new InputSlotMorph( null, @@ -3279,6 +3293,7 @@ CommandBlockMorph.prototype.snap = function () { CommandBlockMorph.prototype.isStop = function () { return ([ + 'doStopThis', 'doStop', 'doStopBlock', 'doStopAll', diff --git a/history.txt b/history.txt index a82204d..70c57bc 100755 --- a/history.txt +++ b/history.txt @@ -2055,3 +2055,8 @@ ______ * Threads, Blocks, Objects: Added StopOthers primitive, thanks, Kartik! * Added „all but this option“ to StopOthers primitive, fixed the implementation * Updated German translation with new strings + +140109 +------ +* Objects: Mechanism for migrating blocks in existing projects to newer versions +* Blocks, Objects, Threads: Collapse old STOP primitives into a single one with a dropdown of options diff --git a/objects.js b/objects.js index 9f892d4..3f3df76 100644 --- a/objects.js +++ b/objects.js @@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2014-January-08'; +modules.objects = '2014-January-09'; var SpriteMorph; var StageMorph; @@ -581,6 +581,9 @@ SpriteMorph.prototype.initBlocks = function () { category: 'control', spec: 'if %b %c else %c' }, + + /* migrated to a newer block version: + doStop: { type: 'command', category: 'control', @@ -591,6 +594,13 @@ SpriteMorph.prototype.initBlocks = function () { category: 'control', spec: 'stop all %stop' }, + */ + + doStopThis: { + type: 'command', + category: 'control', + spec: 'stop %stopChoices' + }, doStopOthers: { type: 'command', category: 'control', @@ -635,11 +645,13 @@ SpriteMorph.prototype.initBlocks = function () { category: 'control', spec: 'report %s' }, - doStopBlock: { + /* + doStopBlock: { // migrated to a newer block version type: 'command', category: 'control', spec: 'stop block' }, + */ doCallCC: { type: 'command', category: 'control', @@ -1084,6 +1096,25 @@ SpriteMorph.prototype.initBlocks = function () { SpriteMorph.prototype.initBlocks(); +SpriteMorph.prototype.initBlockMigrations = function () { + SpriteMorph.prototype.blockMigrations = { + doStopAll: { + selector: 'doStopThis', + inputs: [['all']] + }, + doStop: { + selector: 'doStopThis', + inputs: [['this script']] + }, + doStopBlock: { + selector: 'doStopThis', + inputs: [['this block']] + } + }; +}; + +SpriteMorph.prototype.initBlockMigrations(); + SpriteMorph.prototype.blockAlternatives = { // motion: turn: ['turnLeft'], @@ -1130,9 +1161,6 @@ SpriteMorph.prototype.blockAlternatives = { receiveClick: ['receiveGo'], doBroadcast: ['doBroadcastAndWait'], doBroadcastAndWait: ['doBroadcast'], - doStopBlock: ['doStop', 'doStopAll'], - doStop: ['doStopBlock', 'doStopAll'], - doStopAll: ['doStopBlock', 'doStop'], // sensing: getLastAnswer: ['getTimer'], @@ -1412,8 +1440,9 @@ SpriteMorph.prototype.colorFiltered = function (aColor) { // SpriteMorph block instantiation SpriteMorph.prototype.blockForSelector = function (selector, setDefaults) { - var info, block, defaults, inputs, i; - info = this.blocks[selector]; + var migration, info, block, defaults, inputs, i; + migration = this.blockMigrations[selector]; + info = this.blocks[migration ? migration.selector : selector]; if (!info) {return null; } block = info.type === 'command' ? new CommandBlockMorph() : info.type === 'hat' ? new HatBlockMorph() @@ -1426,8 +1455,8 @@ SpriteMorph.prototype.blockForSelector = function (selector, setDefaults) { block.isStatic = true; } block.setSpec(localize(info.spec)); - if (setDefaults && info.defaults) { - defaults = info.defaults; + if ((setDefaults && info.defaults) || (migration && migration.inputs)) { + defaults = migration ? migration.inputs : info.defaults; block.defaults = defaults; inputs = block.inputs(); if (inputs[0] instanceof MultiArgMorph) { @@ -1651,9 +1680,13 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('doReport')); blocks.push('-'); + /* + // old STOP variants, migrated to a newer version, now redundant blocks.push(block('doStopBlock')); blocks.push(block('doStop')); blocks.push(block('doStopAll')); + */ + blocks.push(block('doStopThis')); blocks.push(block('doStopOthers')); blocks.push('-'); blocks.push(block('doRun')); @@ -4358,9 +4391,13 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('doReport')); blocks.push('-'); + /* + // old STOP variants, migrated to a newer version, now redundant blocks.push(block('doStopBlock')); blocks.push(block('doStop')); blocks.push(block('doStopAll')); + */ + blocks.push(block('doStopThis')); blocks.push(block('doStopOthers')); blocks.push('-'); blocks.push(block('doRun')); diff --git a/threads.js b/threads.js index 8c3eb25..79af3b9 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-January-08'; +modules.threads = '2014-January-09'; var ThreadManager; var Process; @@ -1372,12 +1372,27 @@ Process.prototype.doStopAll = function () { } }; +Process.prototype.doStopThis = function (choice) { + switch (this.inputOption(choice)) { + case 'all': + this.doStopAll(); + break; + case 'this script': + this.doStop(); + break; + case 'this block': + this.doStopBlock(); + break; + default: + nop(); + } +}; + Process.prototype.doStopOthers = function (choice) { var stage; if (this.homeContext.receiver) { stage = this.homeContext.receiver.parentThatIsA(StageMorph); if (stage) { - switch (this.inputOption(choice)) { case 'all but this script': stage.threads.stopAll(this); -- cgit v1.3.1 From fa88fdc761faa224d307e833f74163df48cedb0c Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 9 Jan 2014 18:50:38 +0100 Subject: validated all source files against the latest JSLint version and pushed to this date --- README.md | 2 +- blocks.js | 2 +- byob.js | 4 ++-- cloud.js | 7 ++----- gui.js | 6 +++--- history.txt | 3 ++- lang-de.js | 2 +- lists.js | 4 ++-- locale.js | 2 +- objects.js | 2 +- paint.js | 4 ++-- store.js | 4 ++-- threads.js | 2 +- widgets.js | 4 ++-- 14 files changed, 23 insertions(+), 25 deletions(-) (limited to 'threads.js') diff --git a/README.md b/README.md index 8564d27..cf17e18 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ inspired by Scratch written by Jens Mönig and Brian Harvey jens@moenig.org, bh@cs.berkeley.edu -Copyright (C) 2013 by Jens Mönig and Brian Harvey +Copyright (C) 2014 by Jens Mönig and Brian Harvey Snap! is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as diff --git a/blocks.js b/blocks.js index 9997d70..0ce1478 100644 --- a/blocks.js +++ b/blocks.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. diff --git a/byob.js b/byob.js index 8093266..aff32ad 100644 --- a/byob.js +++ b/byob.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. @@ -106,7 +106,7 @@ SymbolMorph, isNil*/ // Global stuff //////////////////////////////////////////////////////// -modules.byob = '2013-November-26'; +modules.byob = '2014-January-09'; // Declarations diff --git a/cloud.js b/cloud.js index 5ff2f77..17fc76b 100644 --- a/cloud.js +++ b/cloud.js @@ -6,7 +6,7 @@ written by Jens Mönig - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. @@ -29,7 +29,7 @@ /*global modules, IDE_Morph, SnapSerializer, hex_sha512, alert, nop*/ -modules.cloud = '2013-November-26'; +modules.cloud = '2014-January-09'; // Global stuff @@ -37,9 +37,6 @@ var Cloud; var SnapCloud = new Cloud( 'https://snapcloud.miosoft.com/miocon/app/login?_app=SnapCloud' - //'192.168.2.110:8087/miocon/app/login?_app=SnapCloud' - //'192.168.186.146:8087/miocon/app/login?_app=SnapCloud' - // 'localhost/miocon/app/login?_app=SnapCloud' ); // Cloud ///////////////////////////////////////////////////////////// diff --git a/gui.js b/gui.js index d7f562e..0adc325 100644 --- a/gui.js +++ b/gui.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. @@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2013-November-07'; +modules.gui = '2014-January-09'; // Declarations @@ -2391,7 +2391,7 @@ IDE_Morph.prototype.aboutSnap = function () { world = this.world(); aboutTxt = 'Snap! 4.0\nBuild Your Own Blocks\n\n--- beta ---\n\n' - + 'Copyright \u24B8 2013 Jens M\u00F6nig and ' + + 'Copyright \u24B8 2014 Jens M\u00F6nig and ' + 'Brian Harvey\n' + 'jens@moenig.org, bh@cs.berkeley.edu\n\n' diff --git a/history.txt b/history.txt index 2411d8f..f0569ff 100755 --- a/history.txt +++ b/history.txt @@ -2062,4 +2062,5 @@ ______ * Blocks, Objects, Threads: Collapse old STOP primitives into a single one with a dropdown of options * German translation update for new (migrated) STOP block * Morphic: Fixed updateReferences() (how could nobody notice so long?!) -* Store: resolved unexpected assignment expressions (conform to the latest JSLint quibbles) +* XML: resolved unexpected assignment expressions (conform to the latest JSLint quibbles) +* validated all source files against the latest JSLint version diff --git a/lang-de.js b/lang-de.js index 2013833..0b438b5 100644 --- a/lang-de.js +++ b/lang-de.js @@ -6,7 +6,7 @@ written by Jens Mönig - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. diff --git a/lists.js b/lists.js index 60cd7e3..3166bf1 100644 --- a/lists.js +++ b/lists.js @@ -7,7 +7,7 @@ written by Jens Mönig and Brian Harvey jens@moenig.org, bh@cs.berkeley.edu - Copyright (C) 2013 by Jens Mönig and Brian Harvey + Copyright (C) 2014 by Jens Mönig and Brian Harvey This file is part of Snap!. @@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph, StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph, MenuMorph, snapEquals, Morph, isNil, localize, MorphicPreferences*/ -modules.lists = '2013-December-04'; +modules.lists = '2014-January-09'; var List; var ListWatcherMorph; diff --git a/locale.js b/locale.js index eb79862..3b65ec9 100644 --- a/locale.js +++ b/locale.js @@ -6,7 +6,7 @@ written by Jens Mönig - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. diff --git a/objects.js b/objects.js index 3f3df76..af482b1 100644 --- a/objects.js +++ b/objects.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. diff --git a/paint.js b/paint.js index 15b4172..1929f95 100644 --- a/paint.js +++ b/paint.js @@ -5,7 +5,7 @@ inspired by the Scratch paint editor. written by Kartik Chandra - Copyright (C) 2013 by Kartik Chandra + Copyright (C) 2014 by Kartik Chandra This file is part of Snap!. @@ -64,7 +64,7 @@ // Global stuff //////////////////////////////////////////////////////// -modules.paint = '2014-January-08'; +modules.paint = '2014-January-09'; // Declarations diff --git a/store.js b/store.js index 640f2d1..343dca6 100644 --- a/store.js +++ b/store.js @@ -7,7 +7,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. @@ -61,7 +61,7 @@ SyntaxElementMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2013-December-19'; +modules.store = '2014-January-09'; // XML_Serializer /////////////////////////////////////////////////////// diff --git a/threads.js b/threads.js index 79af3b9..722ce6b 100644 --- a/threads.js +++ b/threads.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. diff --git a/widgets.js b/widgets.js index 566d60c..c8dbd03 100644 --- a/widgets.js +++ b/widgets.js @@ -7,7 +7,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mönig + Copyright (C) 2014 by Jens Mönig This file is part of Snap!. @@ -74,7 +74,7 @@ HTMLCanvasElement, fontHeight, SymbolMorph, localize, SpeechBubbleMorph, ArrowMorph, MenuMorph, isString, isNil, SliderMorph, MorphicPreferences, ScrollFrameMorph*/ -modules.widgets = '2013-November-26'; +modules.widgets = '2014-January-09'; var PushButtonMorph; var ToggleButtonMorph; -- cgit v1.3.1 From 3c4e27899c52d32acba275beb90744b35dde74c0 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 10 Jan 2014 11:37:04 +0100 Subject: Revert pull request #295 (xhr-headers) breaks existing installations --- history.txt | 4 ++++ threads.js | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'threads.js') diff --git a/history.txt b/history.txt index f0569ff..d536252 100755 --- a/history.txt +++ b/history.txt @@ -2064,3 +2064,7 @@ ______ * Morphic: Fixed updateReferences() (how could nobody notice so long?!) * XML: resolved unexpected assignment expressions (conform to the latest JSLint quibbles) * validated all source files against the latest JSLint version + +140110 +------ +* Threads: Revert pull request #295 (xhr-headers), breaks existing installations diff --git a/threads.js b/threads.js index 722ce6b..d4a6732 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-January-09'; +modules.threads = '2014-January-10'; var ThreadManager; var Process; @@ -1772,11 +1772,6 @@ Process.prototype.reportURL = function (url) { if (!this.httpRequest) { this.httpRequest = new XMLHttpRequest(); this.httpRequest.open("GET", 'http://' + url, true); - this.httpRequest.setRequestHeader( - "X-Requested-With", - "XMLHttpRequest" - ); - this.httpRequest.setRequestHeader("X-Application", "Snap! 4.0"); this.httpRequest.send(null); } else if (this.httpRequest.readyState === 4) { response = this.httpRequest.responseText; -- cgit v1.3.1 From 3fede790e437df776366789626b96bfd07f3cefa Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 3 Feb 2014 17:11:46 +0100 Subject: Fixed #313 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “Block OF sprite” now works for interpolated (“timed”) blocks and for reporters (i.e. SAY FOR, THINK FOR, GLIDE, ASK etc.) --- history.txt | 4 ++++ threads.js | 35 ++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) (limited to 'threads.js') diff --git a/history.txt b/history.txt index d2ffc1d..8ff5a12 100755 --- a/history.txt +++ b/history.txt @@ -2070,3 +2070,7 @@ ______ * Threads: Revert pull request #295 (xhr-headers), breaks existing installations * BYOB: Fixed #292 (pulldowns loose lines when exported as library) * BYOB: Fixed #291 (readonly custom menus become non-readonly when block is edited) + +140203 +------ +* Threads: Fixed #313. “Block of sprite” now works for interpolated (“timed”) blocks and for reporters (i.e. SAY FOR, THINK FOR, GLIDE, ASK etc.) diff --git a/threads.js b/threads.js index d4a6732..93931c1 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-January-10'; +modules.threads = '2014-Feb-03'; var ThreadManager; var Process; @@ -1643,15 +1643,15 @@ Process.prototype.doGlide = function (secs, endX, endY) { if (!this.context.startTime) { this.context.startTime = Date.now(); this.context.startValue = new Point( - this.homeContext.receiver.xPosition(), - this.homeContext.receiver.yPosition() + this.blockReceiver().xPosition(), + this.blockReceiver().yPosition() ); } if ((Date.now() - this.context.startTime) >= (secs * 1000)) { - this.homeContext.receiver.gotoXY(endX, endY); + this.blockReceiver().gotoXY(endX, endY); return null; } - this.homeContext.receiver.glide( + this.blockReceiver().glide( secs * 1000, endX, endY, @@ -1666,10 +1666,10 @@ Process.prototype.doGlide = function (secs, endX, endY) { Process.prototype.doSayFor = function (data, secs) { if (!this.context.startTime) { this.context.startTime = Date.now(); - this.homeContext.receiver.bubble(data); + this.blockReceiver().bubble(data); } if ((Date.now() - this.context.startTime) >= (secs * 1000)) { - this.homeContext.receiver.stopTalking(); + this.blockReceiver().stopTalking(); return null; } this.pushContext('doYield'); @@ -1679,16 +1679,21 @@ Process.prototype.doSayFor = function (data, secs) { Process.prototype.doThinkFor = function (data, secs) { if (!this.context.startTime) { this.context.startTime = Date.now(); - this.homeContext.receiver.doThink(data); + this.blockReceiver().doThink(data); } if ((Date.now() - this.context.startTime) >= (secs * 1000)) { - this.homeContext.receiver.stopTalking(); + this.blockReceiver().stopTalking(); return null; } this.pushContext('doYield'); this.pushContext(); }; +Process.prototype.blockReceiver = function () { + return this.context ? this.context.receiver || this.homeContext.receiver + : this.homeContext.receiver; +}; + // Process sound primitives (interpolated) Process.prototype.doPlaySoundUntilDone = function (name) { @@ -1723,7 +1728,7 @@ Process.prototype.doStopAllSounds = function () { Process.prototype.doAsk = function (data) { var stage = this.homeContext.receiver.parentThatIsA(StageMorph), - isStage = this.homeContext.receiver instanceof StageMorph, + isStage = this.blockReceiver() instanceof StageMorph, activePrompter; if (!this.prompter) { @@ -1733,7 +1738,7 @@ Process.prototype.doAsk = function (data) { ); if (!activePrompter) { if (!isStage) { - this.homeContext.receiver.bubble(data, false, true); + this.blockReceiver().bubble(data, false, true); } this.prompter = new StagePrompterMorph(isStage ? data : null); if (stage.scale < 1) { @@ -1753,7 +1758,7 @@ Process.prototype.doAsk = function (data) { stage.lastAnswer = this.prompter.inputField.getValue(); this.prompter.destroy(); this.prompter = null; - if (!isStage) {this.homeContext.receiver.stopTalking(); } + if (!isStage) {this.blockReceiver().stopTalking(); } return null; } } @@ -2288,7 +2293,7 @@ Process.prototype.createClone = function (name) { // Process sensing primitives Process.prototype.reportTouchingObject = function (name) { - var thisObj = this.homeContext.receiver; + var thisObj = this.blockReceiver(); if (thisObj) { return this.objectTouchingObject(thisObj, name); @@ -2384,7 +2389,7 @@ Process.prototype.reportColorIsTouchingColor = function (color1, color2) { }; Process.prototype.reportDistanceTo = function (name) { - var thisObj = this.homeContext.receiver, + var thisObj = this.blockReceiver(), thatObj, stage, rc, @@ -2407,7 +2412,7 @@ Process.prototype.reportDistanceTo = function (name) { }; Process.prototype.reportAttributeOf = function (attribute, name) { - var thisObj = this.homeContext.receiver, + var thisObj = this.blockReceiver(), thatObj, stage; -- cgit v1.3.1