From a1b9d3e3964fd363cdb169c9de9287b54e736637 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 20 May 2014 09:43:31 +0200 Subject: Search Blocks feature, keyboard shortcuts Thanks, Kyle, for designing and architecting the search blocks feature!! --- gui.js | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 0f4f2eb..4de6b3d 100644 --- a/gui.js +++ b/gui.js @@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-February-13'; +modules.gui = '2014-May-20'; // Declarations @@ -848,7 +848,7 @@ IDE_Morph.prototype.createCategories = function () { this.add(this.categories); }; -IDE_Morph.prototype.createPalette = function () { +IDE_Morph.prototype.createPalette = function (forSearching) { // assumes that the logo pane has already been created // needs the categories pane for layout var myself = this; @@ -857,7 +857,15 @@ IDE_Morph.prototype.createPalette = function () { this.palette.destroy(); } - this.palette = this.currentSprite.palette(this.currentCategory); + if (forSearching) { + this.palette = new ScrollFrameMorph( + null, + null, + this.currentSprite.sliderColor + ); + } else { + this.palette = this.currentSprite.palette(this.currentCategory); + } this.palette.isDraggable = false; this.palette.acceptsDrops = true; this.palette.contents.acceptsDrops = false; @@ -882,6 +890,7 @@ IDE_Morph.prototype.createPalette = function () { this.add(this.palette); this.palette.scrollX(this.palette.padding); this.palette.scrollY(this.palette.padding); + return this.palette; }; IDE_Morph.prototype.createStage = function () { @@ -2273,23 +2282,7 @@ IDE_Morph.prototype.projectMenu = function () { } ); menu.addItem('Open...', 'openProjectsBrowser'); - menu.addItem( - 'Save', - function () { - if (myself.source === 'examples') { - myself.source = 'local'; // cannot save to examples - } - if (myself.projectName) { - if (myself.source === 'local') { // as well as 'examples' - myself.saveProject(myself.projectName); - } else { // 'cloud' - myself.saveProjectToCloud(myself.projectName); - } - } else { - myself.saveProjectsBrowser(); - } - } - ); + menu.addItem('Save', "save"); if (shiftClicked) { menu.addItem( 'Save to disk', @@ -2720,6 +2713,22 @@ IDE_Morph.prototype.newProject = function () { this.fixLayout(); }; +IDE_Morph.prototype.save = function () { + if (this.source === 'examples') { + this.source = 'local'; // cannot save to examples + } + if (this.projectName) { + if (this.source === 'local') { // as well as 'examples' + this.saveProject(this.projectName); + } else { // 'cloud' + this.saveProjectToCloud(this.projectName); + } + } else { + this.saveProjectsBrowser(); + } +}; + + IDE_Morph.prototype.saveProject = function (name) { var myself = this; this.nextSteps([ -- cgit v1.3.1 From 6a4b4afbe98fa99623a81a89e2f6505ff5704d38 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 26 May 2014 10:46:00 +0200 Subject: Show last-changed-timestamp of cloud projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit display a tool-tip “bubble” in the “Open-Project” dialog next to the preview field --- gui.js | 16 ++++++++++++++-- history.txt | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 4de6b3d..981696a 100644 --- a/gui.js +++ b/gui.js @@ -64,11 +64,12 @@ standardSettings, Sound, BlockMorph, ToggleMorph, InputSlotDialogMorph, ScriptsMorph, isNil, SymbolMorph, BlockExportDialogMorph, BlockImportDialogMorph, SnapTranslator, localize, List, InputSlotMorph, SnapCloud, Uint8Array, HandleMorph, SVG_Costume, fontHeight, hex_sha512, -sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio*/ +sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio, +SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-May-20'; +modules.gui = '2014-May-26'; // Declarations @@ -4533,6 +4534,17 @@ ProjectDialogMorph.prototype.installCloudProjectList = function (pl) { myself.preview.texture = item.Thumbnail || null; myself.preview.cachedTexture = null; myself.preview.drawNew(); + (new SpeechBubbleMorph(new TextMorph( + localize('last changed') + '\n' + item.Updated, + null, + null, + null, + null, + 'center' + ))).popUp( + myself.world(), + myself.preview.rightCenter().add(new Point(2, 0)) + ); } if (item.Public === 'true') { myself.shareButton.hide(); diff --git a/history.txt b/history.txt index 8155285..bd4d9fe 100755 --- a/history.txt +++ b/history.txt @@ -2138,3 +2138,4 @@ ______ ------ * Objects: Fixed #445 (minor search + zoom issues) * Localization additions and Portuguese translation update, thanks, Manuel! +* GUI, cloud: Show last-changed-timestamp when opening cloud projects -- cgit v1.3.1 From bae41fde2870706b200aa9ec2b0e00ca5ceb59d9 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 4 Jun 2014 12:40:44 +0200 Subject: GUI: new (hidden) feature: “Export all scripts as pic” MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (including custom block refs) --- gui.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- history.txt | 6 ++++++ 2 files changed, 66 insertions(+), 1 deletion(-) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 981696a..67510cf 100644 --- a/gui.js +++ b/gui.js @@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2014-May-26'; +modules.gui = '2014-Jun-04'; // Declarations @@ -2350,6 +2350,15 @@ IDE_Morph.prototype.projectMenu = function () { 'show global custom block definitions as XML\nin a new browser window' ); + if (shiftClicked) { + menu.addItem( + 'Export all scripts as pic...', + function () {myself.exportScriptsPicture(); }, + 'show a picture of all scripts\nand block definitions', + new Color(100, 0, 0) + ); + } + menu.addLine(); menu.addItem( 'Import tools', @@ -2847,6 +2856,56 @@ IDE_Morph.prototype.exportSprite = function (sprite) { + ''); }; +IDE_Morph.prototype.exportScriptsPicture = function () { + var pics = [], + pic, + padding = 20, + w = 0, + h = 0, + y = 0, + ctx; + + // collect all script pics + this.sprites.asArray().forEach(function (sprite) { + pics.push(sprite.image); + pics.push(sprite.scripts.scriptsPicture()); + sprite.customBlocks.forEach(function (def) { + pics.push(def.scriptsPicture()); + }); + }); + pics.push(this.stage.image); + pics.push(this.stage.scripts.scriptsPicture()); + this.stage.customBlocks.forEach(function (def) { + pics.push(def.scriptsPicture()); + }); + + // collect global block pics + this.stage.globalBlocks.forEach(function (def) { + pics.push(def.scriptsPicture()); + }); + + pics = pics.filter(function (each) {return !isNil(each); }); + + // determine dimensions of composite + pics.forEach(function (each) { + w = Math.max(w, each.width); + h += (each.height); + h += padding; + }); + h -= padding; + pic = newCanvas(new Point(w, h)); + ctx = pic.getContext('2d'); + + // draw all parts + pics.forEach(function (each) { + ctx.drawImage(each, 0, y); + y += padding; + y += each.height; + }); + + window.open(pic.toDataURL()); +}; + IDE_Morph.prototype.openProjectString = function (str) { var msg, myself = this; diff --git a/history.txt b/history.txt index bd4d9fe..a72aa2c 100755 --- a/history.txt +++ b/history.txt @@ -2139,3 +2139,9 @@ ______ * Objects: Fixed #445 (minor search + zoom issues) * Localization additions and Portuguese translation update, thanks, Manuel! * GUI, cloud: Show last-changed-timestamp when opening cloud projects + +140604 +------ +* Blocks: refactor “script pics” feature +* BYOB: new scriptsPicture() method for custom block definitions +* GUI: new (hidden) feature: “Export all scripts as pic” (including custom block refs) -- cgit v1.3.1 From ac39877b9c7f2cfadfca581fc98fe3b6a3c434fb Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 4 Jun 2014 13:48:43 +0200 Subject: German translation update, tweaks --- gui.js | 1 + history.txt | 3 +++ lang-de.js | 10 +++++++++- lists.js | 2 +- locale.js | 4 ++-- objects.js | 3 ++- store.js | 4 ++-- 7 files changed, 20 insertions(+), 7 deletions(-) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 67510cf..d12453b 100644 --- a/gui.js +++ b/gui.js @@ -2535,6 +2535,7 @@ IDE_Morph.prototype.aboutSnap = function () { + '\n\nNathan Dinsmore: Saving/Loading, Snap-Logo Design, ' + 'countless bugfixes' + '\nKartik Chandra: Paint Editor' + + '\nYuan Yuan: Graphic Effects' + '\nIan Reynolds: UI Design, Event Bindings, ' + 'Sound primitives' + '\nIvan Motyashov: Initial Squeak Porting' diff --git a/history.txt b/history.txt index a72aa2c..a6b3276 100755 --- a/history.txt +++ b/history.txt @@ -2145,3 +2145,6 @@ ______ * Blocks: refactor “script pics” feature * BYOB: new scriptsPicture() method for custom block definitions * GUI: new (hidden) feature: “Export all scripts as pic” (including custom block refs) +* Graphic effects!!! Yay, thanks, Yuan! +* Bug fixes from Nathan, yay, thank, Nathan!! +* German translation update diff --git a/lang-de.js b/lang-de.js index 9ce0c50..0a62da0 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': - '2014-02-13', // this, too, will appear in the Translators tab + '2014-06-04', // this, too, will appear in the Translators tab // GUI // control bar: @@ -1122,8 +1122,16 @@ SnapTranslator.dict.de = { 'Leer', // graphical effects + 'brightness': + 'Helligeit', 'ghost': 'Durchsichtigkeit', + 'negative': + 'Farbumkehr', + 'comic': + 'Moire', + 'confetti': + 'Farbverschiebung', // keys 'space': diff --git a/lists.js b/lists.js index 13ec880..ea553b0 100644 --- a/lists.js +++ b/lists.js @@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph, StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph, MenuMorph, snapEquals, Morph, isNil, localize, MorphicPreferences*/ -modules.lists = '2014-January-09'; +modules.lists = '2014-Jun-04'; var List; var ListWatcherMorph; diff --git a/locale.js b/locale.js index c10aa64..614b38c 100644 --- a/locale.js +++ b/locale.js @@ -42,7 +42,7 @@ /*global modules, contains*/ -modules.locale = '2014-May-26'; +modules.locale = '2014-Jun-04'; // Global stuff @@ -149,7 +149,7 @@ SnapTranslator.dict.de = { 'translator_e-mail': 'jens@moenig.org', 'last_changed': - '2014-02-13' + '2014-06-04' }; SnapTranslator.dict.it = { diff --git a/objects.js b/objects.js index cc4371b..dc02051 100644 --- a/objects.js +++ b/objects.js @@ -61,6 +61,7 @@ sound handling Achal Dave contributed research and prototyping for creating music using the Web Audio API + Yuan Yuan contributed graphic effects for costumes */ @@ -124,7 +125,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2014-May-26'; +modules.objects = '2014-Jun-04'; var SpriteMorph; var StageMorph; diff --git a/store.js b/store.js index e448f74..11e2757 100644 --- a/store.js +++ b/store.js @@ -61,7 +61,7 @@ SyntaxElementMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2014-May-02'; +modules.store = '2014-Jun-04'; // XML_Serializer /////////////////////////////////////////////////////// @@ -1032,7 +1032,7 @@ SnapSerializer.prototype.loadInput = function (model, input, block) { input.setColor(this.loadColor(model.contents)); } else { val = this.loadValue(model); - if (val !== undefined && val !== null && input.setContents) { + if (!isNil(val) && input.setContents) { input.setContents(this.loadValue(model)); } } -- cgit v1.3.1