diff --git a/README.md b/README.md index 1f4f2da937..77c173c746 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ CSnap: Bringing Culture and Social Justice to Programming ========================================================= -http://csdt.rpi.edu +http://csdt.org License ------- diff --git a/gui.js b/gui.js index a6dcff018a..cf702acc1f 100644 --- a/gui.js +++ b/gui.js @@ -274,7 +274,7 @@ IDE_Morph.prototype.init = function (isAutoFill) { this.color = this.backgroundColor; this.corralBarOldX = ""; - this.corralBarOldY = ""; + this.corralBarOldY = ""; }; IDE_Morph.prototype.openIn = function (world) { @@ -338,8 +338,8 @@ IDE_Morph.prototype.openIn = function (world) { // dynamic notifications from non-source text files // has some issues, commented out for now /* - this.cloudMsg = getURL('http://csdt.rpi.edu/cloudmsg.txt'); - motd = getURL('http://csdt.rpi.edu/motd.txt'); + this.cloudMsg = getURL('http://csdt.org/cloudmsg.txt'); + motd = getURL('http://csdt.org/motd.txt'); if (motd) { this.inform('CSnap', motd); } @@ -2252,7 +2252,7 @@ IDE_Morph.prototype.snapMenu = function () { menu.addItem( 'CSnap website', function () { - window.open('http://csdt.rpi.edu/', 'CSnapWebsite'); + window.open('http://csdt.org/', 'CSnapWebsite'); } ); /* XXX: If we really need this in the future, we should link to the CSnap GitHub page. @@ -2466,10 +2466,18 @@ IDE_Morph.prototype.settingsMenu = function () { 'userSetStageSize' ); menu.addLine(); + addPreference( + 'Scale stage image', + 'userSetStageStretch', + this.stage.stageStretch, + 'uncheck to default stage image\nto a max of initial width', + 'check to scale stage image\nto current stage width', + false + ); addPreference( 'Blurred shadows', 'toggleBlurredShadows', - useBlurredShadows, + IDE_Morph.prototype.useBlurredShadows, 'uncheck to use solid drop\nshadows and highlights', 'check to use blurred drop\nshadows and highlights', true @@ -2788,7 +2796,7 @@ IDE_Morph.prototype.projectMenu = function () { function () { myself.droppedText( myself.getURL( - 'https://csdt.rpi.edu/csnapsource/tools.xml' + 'https://csdt.org/csnapsource/tools.xml' ), 'tools' ); @@ -2800,11 +2808,11 @@ IDE_Morph.prototype.projectMenu = function () { function () { // read a list of libraries from an external file, var libMenu = new MenuMorph(this, 'Import library'), - libUrl = 'https://csdt.rpi.edu/csnapsource/libraries/' + + libUrl = 'https://csdt.org/csnapsource/libraries/' + 'LIBRARIES'; function loadLib(name) { - var url = 'https://csdt.rpi.edu/csnapsource/libraries/' + var url = 'https://csdt.org/csnapsource/libraries/' + name + '.xml'; myself.droppedText(myself.getURL(url), name); @@ -4111,6 +4119,12 @@ IDE_Morph.prototype.userSetStageSize = function () { ); }; +// IDE_Morph stage size manipulation + +IDE_Morph.prototype.userSetStageStretch = function () { + this.stage.stageStretch = !this.stage.stageStretch; +}; + IDE_Morph.prototype.setStageExtent = function (aPoint) { var myself = this, world = this.world(), @@ -4528,7 +4542,7 @@ IDE_Morph.prototype.cloudError = function () { // and notify the user about it, // if none is found, show an error dialog box var response = responseText, - explanation = getURL('http://csdt.rpi.edu/cloudmsg.txt'); + explanation = getURL('http://csdt.org/cloudmsg.txt'); if (myself.shield) { myself.shield.destroy(); myself.shield = null; @@ -4752,7 +4766,8 @@ ProjectDialogMorph.prototype.buildContents = function () { } else{ this.addSourceButton('cloud', localize('Cloud'), 'cloud'); - // this.addSourceButton('local', localize('Browser'), 'storage'); + this.addSourceButton('disk', localize('Computer'), 'storage'); + // this.addSourceButton('local', localize('Browser'), 'storage'); Browser Button if (this.task === 'open') { this.addSourceButton('examples', localize('Examples'), 'poster'); } @@ -5050,10 +5065,22 @@ ProjectDialogMorph.prototype.setSource = function (source) { case 'local': this.projectList = this.getLocalProjectList(); break; + case 'disk': + if (this.task === 'save') { + this.projectList = []; + } else { + this.destroy(); + this.ide.importLocalFile(); + return; + } + break; } this.listField.destroy(); this.classroomListField.destroy(); - + + if (this.source === 'disk') { + this.listField.hide(); + } if(this.source === 'goals'){ this.listField = new ListMorph( this.projectList, @@ -5541,7 +5568,11 @@ ProjectDialogMorph.prototype.saveProject = function () { this.ide.setProjectName(name); myself.saveCloudProject(); } - } else { // 'local' + }else if (this.source === 'disk') { + this.ide.exportProject(name, false); + this.ide.source = 'disk'; + this.destroy(); + }else { // 'local' if (detect( this.projectList, function (item) {return item.name === name; } diff --git a/objects.js b/objects.js index 0422c4b1d6..7b2da783cd 100644 --- a/objects.js +++ b/objects.js @@ -694,6 +694,11 @@ SpriteMorph.prototype.initBlocks = function () { type: 'command', category: 'pen', spec: 'fix borders' + }, + flatLineEnds: { + type: 'command', + category: 'pen', + spec: 'flat line end? %b' }, // 3D shapes renderSphere: { @@ -1025,7 +1030,7 @@ SpriteMorph.prototype.initBlocks = function () { type: 'reporter', category: 'sensing', spec: 'http:// %s', - defaults: ['csdt.rpi.edu'] + defaults: ['csdt.org'] }, reportIsFastTracking: { type: 'predicate', @@ -1999,6 +2004,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('doStamp')); blocks.push(block('smoothBorders')); + blocks.push(block('flatLineEnds')); if (this.costume && this.costume.is3D) { blocks.push(block('clear')); @@ -4832,6 +4838,8 @@ StageMorph.prototype.init = function (globals) { this.shownObjects = new List(); this.hiddenObjects = new List(); this.init3D(); + + this.stageStretch = false; }; // StageMorph scaling @@ -4886,11 +4894,22 @@ StageMorph.prototype.drawNew = function () { if (this.costume) { ctx = this.image.getContext('2d'); ctx.scale(this.scale, this.scale); - ctx.drawImage( - this.costume.contents, - (this.width() / this.scale - this.costume.width()) / 2, - (this.height() / this.scale - this.costume.height()) / 2 - ); + if(this.stageStretch){ + console.log('scale Image'); + ctx.drawImage( + this.costume.contents,0,0, + StageMorph.prototype.dimensions.x, this.height() + ); + }else{ + console.log('default'); + ctx.drawImage( + this.costume.contents, + (this.width() / this.scale - this.costume.width()) / 2, + (this.height() / this.scale - this.costume.height()) / 2 + ); + } + + } }; @@ -5926,6 +5945,16 @@ StageMorph.prototype.userMenu = function () { }, 'open a new window\nwith a picture of the stage' ); + // save stage with transparent image + menu.addItem( + "pic without stage...", + function () { + world.children[0].saveFileAs(myself.trailsCanvas.toDataURL(), 'image/png', world.children[0].projetName + ' image'); + }, + 'downloads your work with no\n' + + 'stage image, giving it a \ntransparent background', + ); + if (shiftClicked) { menu.addLine(); menu.addItem( @@ -6476,7 +6505,7 @@ function Costume(canvas, name, rotationCenter, url, is3D, is3dSwitchable) { // newly added for 3D this.url = url; this.is3D = is3D; - this.is3dSwitchable = is3dSwitchable + this.is3dSwitchable = is3dSwitchable; this.geometry = null; this.map = null; } @@ -8043,3 +8072,10 @@ function round10(val,exp) var pow = Math.pow(10,exp); return Math.round(val/pow)*pow; } + + +//CSDT Blocks +SpriteMorph.prototype.flatLineEnds = function(bool){ + SpriteMorph.prototype.useFlatLineEnds = bool; +} + diff --git a/store.js b/store.js index b65da18d91..b8f6cec9b7 100644 --- a/store.js +++ b/store.js @@ -252,7 +252,7 @@ SnapSerializer.uber = XML_Serializer.prototype; // SnapSerializer constants: -SnapSerializer.prototype.app = 'CSnap 1.0, https://csdt.rpi.edu'; +SnapSerializer.prototype.app = 'CSnap 1.0, https://csdt.org'; SnapSerializer.prototype.thumbnailSize = new Point(160, 120); diff --git a/ypr.js b/ypr.js index df96915a8f..44d30a8f76 100644 --- a/ypr.js +++ b/ypr.js @@ -1407,7 +1407,7 @@ var sb = (function (sb) { }); xml = n('project', { name: projectName, - app: 'CSnap 1.0, http://csdt.rpi.edu; serialized by yprxml, http://dl.dropbox.com/u/10715865/Web/snap/app/yprxml.html', + app: 'CSnap 1.0, http://csdt.org; serialized by yprxml, http://dl.dropbox.com/u/10715865/Web/snap/app/yprxml.html', version: '1' }, [ n('notes', {}, [t(project.info.get('comment') || '')]),