diff options
| author | Michael Ball <cycomachead@gmail.com> | 2014-06-21 11:37:25 -0700 |
|---|---|---|
| committer | Michael Ball <cycomachead@gmail.com> | 2014-06-21 11:37:25 -0700 |
| commit | ec8b14a3758acfc852a6f02010394bd5814d7272 (patch) | |
| tree | 2589fd29d40516c3a5c171a5aca6fcff80b7cff9 /gui.js | |
| parent | bf03185eb083ea4171121d25ffda3041d91be8e7 (diff) | |
| parent | 7f8d5a3d1eacdc78f61da8e82ac481bbbb825938 (diff) | |
| download | snap-ec8b14a3758acfc852a6f02010394bd5814d7272.tar.gz snap-ec8b14a3758acfc852a6f02010394bd5814d7272.zip | |
Merge pull request #34 from jmoenig/master
updating cs10 branch from jmoenig 0614
Diffstat (limited to 'gui.js')
| -rw-r--r-- | gui.js | 76 |
1 files changed, 74 insertions, 2 deletions
@@ -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-Jun-04'; // Declarations @@ -2349,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', @@ -2525,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' @@ -2846,6 +2857,56 @@ IDE_Morph.prototype.exportSprite = function (sprite) { + '</sprites>'); }; +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; @@ -4533,6 +4594,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(); |
