From 1f88f65e9d9caf277dfedd5fe447e3cdcfd6cdf9 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 23 Feb 2015 15:15:46 +0100 Subject: Avoid incompatibility warning for very old (pre-earmarked) projects --- store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'store.js') diff --git a/store.js b/store.js index 056767f..8adf7f7 100644 --- a/store.js +++ b/store.js @@ -61,7 +61,7 @@ SyntaxElementMorph, Variable*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2015-January-21'; +modules.store = '2015-February-23'; // XML_Serializer /////////////////////////////////////////////////////// @@ -320,7 +320,7 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode, ide) { var appInfo = xmlNode.attributes.app, app = appInfo ? appInfo.split(' ')[0] : null; - if (ide && app !== this.app.split(' ')[0]) { + if (ide && app && app !== this.app.split(' ')[0]) { ide.inform( app + ' Project', 'This project has been created by a different app:\n\n' + -- cgit v1.3.1 From 85388f19391aeb2d5ba87d36bbabace55ce842df Mon Sep 17 00:00:00 2001 From: Jens Mönig Date: Tue, 24 Feb 2015 06:47:12 +0100 Subject: fixed #725 --- history.txt | 4 ++++ store.js | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'store.js') diff --git a/history.txt b/history.txt index c73e5ff..7b0b6e5 100755 --- a/history.txt +++ b/history.txt @@ -2447,3 +2447,7 @@ ______ * Blocks, Objects: Add user-interaction choices to the “When I am ...” hat block * Update German translation * Store: Avoid incompatibility warning for very old (pre-earmarked) projects + +150224 +------ +* Store: fixed #725 diff --git a/store.js b/store.js index 8adf7f7..91ff40e 100644 --- a/store.js +++ b/store.js @@ -61,7 +61,7 @@ SyntaxElementMorph, Variable*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2015-February-23'; +modules.store = '2015-February-24'; // XML_Serializer /////////////////////////////////////////////////////// @@ -977,7 +977,11 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter) { ); } if (!receiver) { - return this.obsoleteBlock(isReporter); + if (!isGlobal) { + receiver = this.project.stage; + } else { + return this.obsoleteBlock(isReporter); + } } if (isGlobal) { info = detect(receiver.globalBlocks, function (block) { -- cgit v1.3.1 From ee88f7ad398fe9867ad1bcf1c2588704fc012151 Mon Sep 17 00:00:00 2001 From: Jens Mönig Date: Sat, 28 Feb 2015 05:44:59 -0800 Subject: Cache inputs - accelerate recursive reporters and warped / turbo recursive commands by up to 40% --- blocks.js | 29 ++++++++++++++++++++++++----- gui.js | 13 ++++++++++++- history.txt | 4 ++++ store.js | 3 ++- 4 files changed, 42 insertions(+), 7 deletions(-) (limited to 'store.js') diff --git a/blocks.js b/blocks.js index 72aa5d0..5cdcc1c 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2015-February-23'; +modules.blocks = '2015-February-28'; var SyntaxElementMorph; @@ -340,6 +340,7 @@ SyntaxElementMorph.prototype.setScale = function (num) { }; SyntaxElementMorph.prototype.setScale(1); +SyntaxElementMorph.prototype.isCachingInputs = true; // SyntaxElementMorph instance creation: @@ -356,6 +357,7 @@ SyntaxElementMorph.prototype.init = function () { SyntaxElementMorph.uber.init.call(this); this.defaults = []; + this.cachedInputs = null; }; // SyntaxElementMorph accessing: @@ -375,10 +377,12 @@ SyntaxElementMorph.prototype.parts = function () { SyntaxElementMorph.prototype.inputs = function () { // answer my arguments and nested reporters - return this.parts().filter(function (part) { - return part instanceof SyntaxElementMorph; - }); - + if (isNil(this.cachedInputs) || !this.isCachingInputs) { + this.cachedInputs = this.parts().filter(function (part) { + return part instanceof SyntaxElementMorph; + }); + } + return this.cachedInputs; }; SyntaxElementMorph.prototype.allInputs = function () { @@ -494,6 +498,7 @@ SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) { replacement.drawNew(); this.fixLayout(); } + this.cachedInputs = null; this.endLayout(); }; @@ -529,6 +534,7 @@ SyntaxElementMorph.prototype.silentReplaceInput = function (oldArg, newArg) { replacement.drawNew(); this.fixLayout(); } + this.cachedInputs = null; }; SyntaxElementMorph.prototype.revertToDefaultInput = function (arg, noValues) { @@ -571,6 +577,7 @@ SyntaxElementMorph.prototype.revertToDefaultInput = function (arg, noValues) { } else if (deflt instanceof RingMorph) { deflt.fixBlockColor(); } + this.cachedInputs = null; }; SyntaxElementMorph.prototype.isLocked = function () { @@ -1942,6 +1949,7 @@ BlockMorph.prototype.init = function () { BlockMorph.uber.init.call(this); this.color = new Color(0, 17, 173); + this.cashedInputs = null; }; BlockMorph.prototype.receiver = function () { @@ -2047,6 +2055,7 @@ BlockMorph.prototype.setSpec = function (spec) { }); this.blockSpec = spec; this.fixLayout(); + this.cachedInputs = null; }; BlockMorph.prototype.buildSpec = function () { @@ -2439,6 +2448,7 @@ BlockMorph.prototype.restoreInputs = function (oldInputs) { } i += 1; }); + this.cachedInputs = null; }; BlockMorph.prototype.showHelp = function () { @@ -3034,6 +3044,7 @@ BlockMorph.prototype.fullCopy = function () { //block.comment = null; }); + ans.cachedInputs = null; return ans; }; @@ -9186,6 +9197,10 @@ MultiArgMorph.prototype = new ArgMorph(); MultiArgMorph.prototype.constructor = MultiArgMorph; MultiArgMorph.uber = ArgMorph.prototype; +// MultiArgMorph preferences settings + +MultiArgMorph.prototype.isCachingInputs = false; + // MultiArgMorph instance creation: function MultiArgMorph( @@ -9616,6 +9631,10 @@ ArgLabelMorph.prototype = new ArgMorph(); ArgLabelMorph.prototype.constructor = ArgLabelMorph; ArgLabelMorph.uber = ArgMorph.prototype; +// ArgLabelMorph preferences settings + +ArgLabelMorph.prototype.isCachingInputs = false; + // MultiArgMorph instance creation: function ArgLabelMorph(argMorph, labelTxt) { diff --git a/gui.js b/gui.js index 9fddf4d..75220b3 100644 --- a/gui.js +++ b/gui.js @@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2015-February-23'; +modules.gui = '2015-February-28'; // Declarations @@ -2266,6 +2266,17 @@ IDE_Morph.prototype.settingsMenu = function () { 'uncheck to run scripts\nat normal speed', 'check to prioritize\nscript execution' ); + addPreference( + 'Cache Inputs', + function () { + SyntaxElementMorph.prototype.isCachingInputs = + !SyntaxElementMorph.prototype.isCachingInputs; + }, + SyntaxElementMorph.prototype.isCachingInputs, + 'uncheck to stop caching\ninputs (for debugging the evaluator)', + 'check to cache inputs\nboosts recursion', + true + ); addPreference( 'Rasterize SVGs', function () { diff --git a/history.txt b/history.txt index 7b0b6e5..1c33405 100755 --- a/history.txt +++ b/history.txt @@ -2451,3 +2451,7 @@ ______ 150224 ------ * Store: fixed #725 + +150228 +------ +* Blocks, Store, GUI: Cache inputs, accelerates evaluating recursive reporters and warped / turbo recursive commands by up to 40% diff --git a/store.js b/store.js index 91ff40e..b17fb49 100644 --- a/store.js +++ b/store.js @@ -61,7 +61,7 @@ SyntaxElementMorph, Variable*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2015-February-24'; +modules.store = '2015-February-28'; // XML_Serializer /////////////////////////////////////////////////////// @@ -1027,6 +1027,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter) { this.loadInput(child, inputs[i], block); } }, this); + block.cachedInputs = null; return block; }; -- cgit v1.3.1