diff options
| author | Gubolin <gubolin@fantasymail.de> | 2015-05-06 15:32:17 +0200 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2015-05-06 15:32:17 +0200 |
| commit | b0d5fca03273d74c009c1415285c0ec375e1f848 (patch) | |
| tree | 38a6a8ab1714f0f0945cd6b1a093503c8e9ac127 | |
| parent | 8a83be1c8a37ed3b3672c77028741ec5ec8c7b5a (diff) | |
| parent | 83628bc0aca42c078a96b0a6fbb2675cf6cae5c3 (diff) | |
| download | snap-b0d5fca03273d74c009c1415285c0ec375e1f848.tar.gz snap-b0d5fca03273d74c009c1415285c0ec375e1f848.zip | |
merge upstream
| -rw-r--r-- | blocks.js | 11 | ||||
| -rw-r--r-- | byob.js | 10 | ||||
| -rw-r--r-- | gui.js | 34 | ||||
| -rwxr-xr-x | history.txt | 17 | ||||
| -rw-r--r-- | morphic.js | 5 | ||||
| -rw-r--r-- | objects.js | 71 | ||||
| -rw-r--r-- | threads.js | 6 |
7 files changed, 137 insertions, 17 deletions
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2015-March-23'; +modules.blocks = '2015-May-01'; var SyntaxElementMorph; @@ -7024,6 +7024,15 @@ InputSlotMorph.prototype.fixLayout = function () { // InputSlotMorph events: +InputSlotMorph.prototype.mouseDownLeft = function (pos) { + if (this.isReadOnly || this.arrow().bounds.containsPoint(pos)) { + this.escalateEvent('mouseDownLeft', pos); + } else { + this.contents().edit(); + this.contents().selectAll(); + } +}; + InputSlotMorph.prototype.mouseClickLeft = function (pos) { if (this.arrow().bounds.containsPoint(pos)) { this.dropDownMenu(); @@ -106,7 +106,7 @@ SymbolMorph, isNil*/ // Global stuff //////////////////////////////////////////////////////// -modules.byob = '2015-March-02'; +modules.byob = '2015-May-01'; // Declarations @@ -2049,7 +2049,13 @@ BlockLabelFragment.prototype.defTemplateSpecFragment = function () { )) { suff = ' \u03BB'; } else if (this.defaultValue) { - suff = ' = ' + this.defaultValue.toString(); + if (this.type === '%n') { + suff = ' # = ' + this.defaultValue.toString(); + } else { // 'any' or 'text' + suff = ' = ' + this.defaultValue.toString(); + } + } else if (this.type === '%n') { + suff = ' #'; } return this.labelString + suff; }; @@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2015-March-21'; +modules.gui = '2015-May-01'; // Declarations @@ -439,8 +439,21 @@ IDE_Morph.prototype.openIn = function (world) { myself.shield.destroy(); myself.shield = null; msg.destroy(); - myself.toggleAppMode(true); - myself.runScripts(); + + if (dict.editMode) { + myself.toggleAppMode(false); + } else { + myself.toggleAppMode(true); + } + + if (!dict.noRun) { + myself.runScripts(); + } + + if (dict.hideControls) { + myself.controlBar.hide(); + window.onbeforeunload = function () {nop(); }; + } } ]); }, @@ -2527,12 +2540,15 @@ IDE_Morph.prototype.projectMenu = function () { if (GitHub.username) { menu.addItem('Save with commit message', 'commitProjectToGitHub'); } - menu.addItem( - 'Save to disk', - 'saveProjectToDisk', - 'store this project\nin the downloads folder\n' - + '(in supporting browsers)' - ); + if (shiftClicked) { + menu.addItem( + 'Save to disk', + 'saveProjectToDisk', + 'store this project\nin the downloads folder\n' + + '(in supporting browsers)', + new Color(100, 0, 0) + ); + } menu.addItem('Save As...', 'saveProjectsBrowser'); menu.addLine(); menu.addItem( diff --git a/history.txt b/history.txt index 8a2066d..7f60776 100755 --- a/history.txt +++ b/history.txt @@ -2493,3 +2493,20 @@ ______ ------ * Threads: fixed #752 * OOP: integrated and adjusted fix for #752 + +150415 +------ +* Threads: flush Stage>>keysPressed when prompting the user +* Objects: fixed #770 + +150415 +------ +* OOP: Objects, Prototypal inheritance of sprite-local custom blocks (palette only) + +150501 +------ +* Morphic, Blocks: select all text when first clicking an input slot +* BYOB: indicate numeric inputs in the block prototype with the # sign +* Threads: return empty string when querying first letter of a list +* GUI: hide “save to disk” option behind shift-click again (has issues in Chrome) +* GUI: parameters for embedding projects in iFrames, thanks, Bernat! @@ -1048,7 +1048,7 @@ /*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio, FileList, getBlurredShadowSupport*/ -var morphicVersion = '2015-March-24'; +var morphicVersion = '2015-May-01'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug @@ -7454,6 +7454,8 @@ StringMorph.prototype.mouseClickLeft = function (pos) { StringMorph.prototype.enableSelecting = function () { this.mouseDownLeft = function (pos) { + var crs = this.root().cursor, + already = crs ? crs.target === this : false; this.clearSelection(); if (this.isEditable && (!this.isDraggable)) { this.edit(); @@ -7461,6 +7463,7 @@ StringMorph.prototype.enableSelecting = function () { this.startMark = this.slotAt(pos); this.endMark = this.startMark; this.currentlySelecting = true; + if (!already) {this.escalateEvent('mouseDownLeft', pos); } } }; this.mouseMove = function (pos) { @@ -125,7 +125,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2015-March-24'; +modules.objects = '2015-April-17'; var SpriteMorph; var StageMorph; @@ -2503,6 +2503,29 @@ SpriteMorph.prototype.freshPalette = function (category) { } }); + // inherited custom blocks: (under construction...) + + // y += unit * 1.6; + if (this.exemplar) { + this.inheritedBlocks(true).forEach(function (definition) { + var block; + if (definition.category === category || + (category === 'variables' + && contains( + ['lists', 'other'], + definition.category + ))) { + block = definition.templateInstance(); + y += unit * 0.3; + block.setPosition(new Point(x, y)); + palette.addContents(block); + block.ghost(); + x = 0; + y += block.height(); + } + }); + } + //layout palette.scrollX(palette.padding); @@ -3281,7 +3304,7 @@ SpriteMorph.prototype.setEffect = function (effect, value) { if (eff === 'ghost') { this.alpha = 1 - Math.min(Math.max(+value || 0, 0), 100) / 100; } else { - this.graphicsValues[eff] = value; + this.graphicsValues[eff] = +value; } this.drawNew(); this.changed(); @@ -3296,7 +3319,7 @@ SpriteMorph.prototype.changeEffect = function (effect, value) { if (eff === 'ghost') { this.setEffect(effect, this.getGhostEffect() + (+value || 0)); } else { - this.setEffect(effect, this.graphicsValues[eff] + value); + this.setEffect(effect, +this.graphicsValues[eff] + (+value)); } }; @@ -4458,6 +4481,48 @@ SpriteMorph.prototype.deletableVariableNames = function () { ); }; +// SpriteMorph inheritance - custom blocks + +SpriteMorph.prototype.ownBlocks = function () { + var dict = {}; + this.customBlocks.forEach(function (def) { + dict[def.blockSpec()] = def; + }); + return dict; +}; + +SpriteMorph.prototype.allBlocks = function (valuesOnly) { + var dict = {}; + this.allExemplars().reverse().forEach(function (sprite) { + sprite.customBlocks.forEach(function (def) { + dict[def.blockSpec()] = def; + }); + }); + if (valuesOnly) { + return Object.keys(dict).map(function (key) {return dict[key]; }); + } + return dict; +}; + +SpriteMorph.prototype.inheritedBlocks = function (valuesOnly) { + var dict = {}, + own = Object.keys(this.ownBlocks()), + others = this.allExemplars().reverse(); + others.pop(); + others.forEach(function (sprite) { + sprite.customBlocks.forEach(function (def) { + var spec = def.blockSpec(); + if (!contains(own, spec)) { + dict[spec] = def; + } + }); + }); + if (valuesOnly) { + return Object.keys(dict).map(function (key) {return dict[key]; }); + } + return dict; +}; + // SpriteMorph highlighting SpriteMorph.prototype.addHighlight = function (oldHighlight) { @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2015-March-25'; +modules.threads = '2015-May-01'; var ThreadManager; var Process; @@ -1928,6 +1928,7 @@ Process.prototype.doAsk = function (data) { isStage = this.blockReceiver() instanceof StageMorph, activePrompter; + stage.keysPressed = {}; if (!this.prompter) { activePrompter = detect( stage.children, @@ -2297,6 +2298,9 @@ Process.prototype.reportJoinWords = function (aList) { // Process string ops Process.prototype.reportLetter = function (idx, string) { + if (string instanceof List) { // catch a common user error + return ''; + } var i = +(idx || 0), str = (string || '').toString(); return str[i - 1] || ''; |
