From 68073e50809c464ec3ee3b192eac1557fe4fac4a Mon Sep 17 00:00:00 2001 From: Manuel Menezes de Sequeira Date: Tue, 29 Jul 2014 14:32:00 +0100 Subject: Add Portuguese translation of 'move'. Move was added to the German translation. --- lang-pt.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang-pt.js b/lang-pt.js index 488c706..2c0e1be 100755 --- a/lang-pt.js +++ b/lang-pt.js @@ -835,6 +835,8 @@ SnapTranslator.dict.pt = { // actores: 'edit': 'editar', + 'move': + 'mover', 'detach from': 'soltar de', 'detach all parts': -- cgit v1.3.1 From b2399309e4f207d44f57c73f7a92c60f16c9d3ca Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 30 Jul 2014 09:40:31 +0200 Subject: propagate HIDE and SHOW to nested sprite parts --- history.txt | 4 ++++ objects.js | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/history.txt b/history.txt index 0568bda..6bb4137 100755 --- a/history.txt +++ b/history.txt @@ -2250,3 +2250,7 @@ ______ * updated German translation * Morphic: fixed #497 (prevent bubble shadows from getting cut-off) * Blocks: keep result-bubbles within the enclosing scripting pane + +140730 +------ +* Objects: propagate HIDE and SHOW to nested sprite parts diff --git a/objects.js b/objects.js index c4c4eb8..fbb9e84 100644 --- a/objects.js +++ b/objects.js @@ -125,7 +125,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2014-July-29'; +modules.objects = '2014-July-30'; var SpriteMorph; var StageMorph; @@ -2708,6 +2708,23 @@ SpriteMorph.prototype.removeClone = function () { // SpriteMorph primitives +// SpriteMorph hiding and showing: + +/* + override the inherited behavior to also hide/show all + nested parts. +*/ + +SpriteMorph.prototype.hide = function () { + SpriteMorph.uber.hide.call(this); + this.parts.forEach(function (part) {part.hide(); }); +}; + +SpriteMorph.prototype.show = function () { + SpriteMorph.uber.show.call(this); + this.parts.forEach(function (part) {part.show(); }); +}; + // SpriteMorph pen color SpriteMorph.prototype.setColor = function (aColor) { -- cgit v1.3.1 From 9f7028dbf95262cde83a524abc59987736eb5d32 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 30 Jul 2014 12:39:33 +0200 Subject: propagate DELETE to nested sprite parts --- gui.js | 6 ++++-- history.txt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gui.js b/gui.js index e4c75dd..6af9137 100644 --- a/gui.js +++ b/gui.js @@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-July-29'; +modules.gui = '2014-July-30'; // Declarations @@ -1831,7 +1831,9 @@ IDE_Morph.prototype.duplicateSprite = function (sprite) { }; IDE_Morph.prototype.removeSprite = function (sprite) { - var idx = this.sprites.asArray().indexOf(sprite) + 1; + var idx, myself = this; + sprite.parts.forEach(function (part) {myself.removeSprite(part); }); + idx = this.sprites.asArray().indexOf(sprite) + 1; this.stage.threads.stopAllForReceiver(sprite); sprite.destroy(); this.stage.watchers().forEach(function (watcher) { diff --git a/history.txt b/history.txt index 6bb4137..b67e91c 100755 --- a/history.txt +++ b/history.txt @@ -2254,3 +2254,4 @@ ______ 140730 ------ * Objects: propagate HIDE and SHOW to nested sprite parts +* GUI: propagate DELETE to nested sprite parts -- cgit v1.3.1 From 61dd479a2b5b79714cf9125d222fb7996674f1a7 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 30 Jul 2014 16:28:01 +0200 Subject: export script pic with result bubble hidden option in the shift-context-menu of reporter scripts --- blocks.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- history.txt | 1 + threads.js | 26 ++++++++++++++++++++------ 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/blocks.js b/blocks.js index 5a15fa4..2e297ab 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2014-July-29'; +modules.blocks = '2014-July-30'; var SyntaxElementMorph; @@ -1621,7 +1621,7 @@ SyntaxElementMorph.prototype.isEmptySlot = function () { // SyntaxElementMorph speech bubble feedback: -SyntaxElementMorph.prototype.showBubble = function (value) { +SyntaxElementMorph.prototype.showBubble = function (value, exportPic) { var bubble, txt, img, @@ -1695,11 +1695,28 @@ SyntaxElementMorph.prototype.showBubble = function (value) { this.rightCenter().add(new Point(2, 0)), isClickable ); + if (exportPic) { + this.exportPictureWithResult(bubble); + } if (sf) { bubble.keepWithin(sf); } }; +SyntaxElementMorph.prototype.exportPictureWithResult = function (aBubble) { + var scr = this.fullImage(), + bub = aBubble.fullImageClassic(), + taller = Math.max(0, bub.height - scr.height), + pic = newCanvas(new Point( + scr.width + bub.width + 2, + scr.height + taller + )), + ctx = pic.getContext('2d'); + ctx.drawImage(scr, 0, pic.height - scr.height); + ctx.drawImage(bub, scr.width + 2, 0); + window.open(pic.toDataURL()); +}; + // SyntaxElementMorph code mapping /* @@ -2026,13 +2043,29 @@ BlockMorph.prototype.userMenu = function () { var menu = new MenuMorph(this), world = this.world(), myself = this, + shiftClicked = world.currentKey === 16, alternatives, + top, blck; menu.addItem( "help...", 'showHelp' ); + if (shiftClicked) { + top = this.topBlock(); + if (top instanceof ReporterBlockMorph) { + menu.addItem( + "script pic with result...", + function () { + top.ExportResultPic(); + }, + 'open a new window\n' + + 'with a picture of both\nthis script and its result', + new Color(100, 0, 0) + ); + } + } if (this.isTemplate) { if (!(this.parent instanceof SyntaxElementMorph)) { if (this.selector !== 'evaluateCustomBlock') { @@ -4115,6 +4148,23 @@ ReporterBlockMorph.prototype.mouseClickLeft = function (pos) { } }; +// ReporterBlock exporting picture with result bubble + +ReporterBlockMorph.prototype.ExportResultPic = function () { + var top = this.topBlock(), + receiver = top.receiver(), + stage; + if (top !== this) {return; } + if (receiver) { + stage = receiver.parentThatIsA(StageMorph); + if (stage) { + stage.threads.stopProcess(top); + stage.threads.startProcess(top, false, true); + } + } +}; + + // ReporterBlockMorph deleting ReporterBlockMorph.prototype.userDestroy = function () { diff --git a/history.txt b/history.txt index b67e91c..0a7dfe6 100755 --- a/history.txt +++ b/history.txt @@ -2255,3 +2255,4 @@ ______ ------ * Objects: propagate HIDE and SHOW to nested sprite parts * GUI: propagate DELETE to nested sprite parts +* Blocks, Threads: export script pic with result bubble (shift-context-menu of reporter scripts) diff --git a/threads.js b/threads.js index 4989a23..3324ac6 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-July-28'; +modules.threads = '2014-July-30'; var ThreadManager; var Process; @@ -134,7 +134,11 @@ ThreadManager.prototype.toggleProcess = function (block) { } }; -ThreadManager.prototype.startProcess = function (block, isThreadSafe) { +ThreadManager.prototype.startProcess = function ( + block, + isThreadSafe, + exportResult +) { var active = this.findProcess(block), top = block.topBlock(), newProc; @@ -147,6 +151,7 @@ ThreadManager.prototype.startProcess = function (block, isThreadSafe) { } top.addHighlight(); newProc = new Process(block.topBlock()); + newProc.exportResult = exportResult; this.processes.push(newProc); return newProc; }; @@ -232,11 +237,17 @@ ThreadManager.prototype.removeTerminatedProcesses = function () { if (proc.topBlock instanceof ReporterBlockMorph) { if (proc.homeContext.inputs[0] instanceof List) { - proc.topBlock.showBubble(new ListWatcherMorph( - proc.homeContext.inputs[0] - )); + proc.topBlock.showBubble( + new ListWatcherMorph( + proc.homeContext.inputs[0] + ), + proc.exportResult + ); } else { - proc.topBlock.showBubble(proc.homeContext.inputs[0]); + proc.topBlock.showBubble( + proc.homeContext.inputs[0], + proc.exportResult + ); } } } else { @@ -302,6 +313,8 @@ ThreadManager.prototype.findProcess = function (block) { httpRequest active instance of an HttpRequest or null pauseOffset msecs between the start of an interpolated operation and when the process was paused + exportResult boolean flag indicating whether a picture of the top + block along with the result bubble shoud be exported */ Process.prototype = {}; @@ -325,6 +338,7 @@ function Process(topBlock) { this.isPaused = false; this.pauseOffset = null; this.frameCount = 0; + this.exportResult = false; if (topBlock) { this.homeContext.receiver = topBlock.receiver(); -- cgit v1.3.1