Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CSnap: Bringing Culture and Social Justice to Programming
=========================================================

http://csdt.rpi.edu
http://csdt.org

License
-------
Expand Down
55 changes: 43 additions & 12 deletions gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
);
Expand All @@ -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);
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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; }
Expand Down
50 changes: 43 additions & 7 deletions objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -4832,6 +4838,8 @@ StageMorph.prototype.init = function (globals) {
this.shownObjects = new List();
this.hiddenObjects = new List();
this.init3D();

this.stageStretch = false;
};

// StageMorph scaling
Expand Down Expand Up @@ -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
);
}


}
};

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

2 changes: 1 addition & 1 deletion store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ypr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') || '')]),
Expand Down