summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2015-01-24 10:21:12 +0100
committerGubolin <gubolin@fantasymail.de>2015-01-24 10:21:12 +0100
commite8c854f84aef6d160cfacb4b6a7a5723716cb72e (patch)
tree023adc90688fc3e9306c93afda3fdd26f5be49b1 /gui.js
parentc09c227ce312f0ec649577b206b84794a3507754 (diff)
parent2ca378c50bf67b6af5e16ba72af81f4f84db308c (diff)
downloadsnap-e8c854f84aef6d160cfacb4b6a7a5723716cb72e.tar.gz
snap-e8c854f84aef6d160cfacb4b6a7a5723716cb72e.zip
Merge branch 'master' into mobileapp
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js81
1 files changed, 61 insertions, 20 deletions
diff --git a/gui.js b/gui.js
index 063433a..206b27a 100644
--- a/gui.js
+++ b/gui.js
@@ -9,7 +9,7 @@
written by Jens Mönig
jens@moenig.org
- Copyright (C) 2014 by Jens Mönig
+ Copyright (C) 2015 by Jens Mönig
This file is part of Snap!.
@@ -69,7 +69,7 @@ SpeechBubbleMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.gui = '2014-December-04';
+modules.gui = '2015-January-21';
// Declarations
@@ -119,7 +119,7 @@ IDE_Morph.prototype.setDefaultDesign = function () {
];
IDE_Morph.prototype.rotationStyleColors = IDE_Morph.prototype.tabColors;
IDE_Morph.prototype.appModeColor = new Color();
- IDE_Morph.prototype.scriptsPaneTexture = 'scriptsPaneTexture.gif';
+ IDE_Morph.prototype.scriptsPaneTexture = this.scriptsTexture();
IDE_Morph.prototype.padding = 5;
SpriteIconMorph.prototype.labelColor
@@ -172,6 +172,22 @@ IDE_Morph.prototype.setFlatDesign = function () {
= IDE_Morph.prototype.buttonLabelColor;
};
+IDE_Morph.prototype.scriptsTexture = function () {
+ var pic = newCanvas(new Point(100, 100)), // bigger scales faster
+ ctx = pic.getContext('2d'),
+ i;
+ for (i = 0; i < 100; i += 4) {
+ ctx.fillStyle = this.frameColor.toString();
+ ctx.fillRect(i, 0, 1, 100);
+ ctx.fillStyle = this.groupColor.lighter(6).toString();
+ ctx.fillRect(i + 1, 0, 1, 100);
+ ctx.fillRect(i + 3, 0, 1, 100);
+ ctx.fillStyle = this.groupColor.toString();
+ ctx.fillRect(i + 2, 0, 1, 100);
+ }
+ return pic;
+};
+
IDE_Morph.prototype.setDefaultDesign();
// IDE_Morph instance creation:
@@ -300,7 +316,6 @@ IDE_Morph.prototype.openIn = function (world) {
this.inform('Snap!', motd);
}
*/
-
function interpretUrlAnchors() {
var dict;
if (location.hash.substr(0, 6) === '#open:') {
@@ -353,6 +368,7 @@ IDE_Morph.prototype.openIn = function (world) {
function () {
msg = myself.showMessage('Opening project...');
},
+ function () {nop(); }, // yield (bug in Chrome)
function () {
if (projectData.indexOf('<snapdata') === 0) {
myself.rawOpenCloudDataString(projectData);
@@ -1152,7 +1168,7 @@ IDE_Morph.prototype.createSpriteEditor = function () {
if (this.currentTab === 'scripts') {
scripts.isDraggable = false;
scripts.color = this.groupColor;
- scripts.texture = this.scriptsPaneTexture;
+ scripts.cachedTexture = this.scriptsPaneTexture;
this.spriteEditor = new ScrollFrameMorph(
scripts,
@@ -2046,6 +2062,7 @@ IDE_Morph.prototype.cloudMenu = function () {
'Opening project...'
);
},
+ function () {nop(); }, // yield (Chrome)
function () {
myself.rawOpenCloudDataString(
projectData
@@ -2509,7 +2526,7 @@ IDE_Morph.prototype.aboutSnap = function () {
world = this.world();
aboutTxt = 'Snap! 4.0\nBuild Your Own Blocks\n\n--- beta ---\n\n'
- + 'Copyright \u24B8 2014 Jens M\u00F6nig and '
+ + 'Copyright \u24B8 2015 Jens M\u00F6nig and '
+ 'Brian Harvey\n'
+ 'jens@moenig.org, bh@cs.berkeley.edu\n\n'
@@ -2925,6 +2942,7 @@ IDE_Morph.prototype.openProjectString = function (str) {
function () {
msg = myself.showMessage('Opening project...');
},
+ function () {nop(); }, // yield (bug in Chrome)
function () {
myself.rawOpenProjectString(str);
},
@@ -2943,12 +2961,18 @@ IDE_Morph.prototype.rawOpenProjectString = function (str) {
StageMorph.prototype.enableCodeMapping = false;
if (Process.prototype.isCatchingErrors) {
try {
- this.serializer.openProject(this.serializer.load(str), this);
+ this.serializer.openProject(
+ this.serializer.load(str, this),
+ this
+ );
} catch (err) {
this.showMessage('Load failed: ' + err);
}
} else {
- this.serializer.openProject(this.serializer.load(str), this);
+ this.serializer.openProject(
+ this.serializer.load(str, this),
+ this
+ );
}
this.stopFastTracking();
};
@@ -2960,6 +2984,7 @@ IDE_Morph.prototype.openCloudDataString = function (str) {
function () {
msg = myself.showMessage('Opening project...');
},
+ function () {nop(); }, // yield (bug in Chrome)
function () {
myself.rawOpenCloudDataString(str);
},
@@ -2980,7 +3005,10 @@ IDE_Morph.prototype.rawOpenCloudDataString = function (str) {
model = this.serializer.parse(str);
this.serializer.loadMediaModel(model.childNamed('media'));
this.serializer.openProject(
- this.serializer.loadProjectModel(model.childNamed('project')),
+ this.serializer.loadProjectModel(
+ model.childNamed('project'),
+ this
+ ),
this
);
} catch (err) {
@@ -2990,7 +3018,10 @@ IDE_Morph.prototype.rawOpenCloudDataString = function (str) {
model = this.serializer.parse(str);
this.serializer.loadMediaModel(model.childNamed('media'));
this.serializer.openProject(
- this.serializer.loadProjectModel(model.childNamed('project')),
+ this.serializer.loadProjectModel(
+ model.childNamed('project'),
+ this
+ ),
this
);
}
@@ -3004,6 +3035,7 @@ IDE_Morph.prototype.openBlocksString = function (str, name, silently) {
function () {
msg = myself.showMessage('Opening blocks...');
},
+ function () {nop(); }, // yield (bug in Chrome)
function () {
myself.rawOpenBlocksString(str, name, silently);
},
@@ -3050,6 +3082,7 @@ IDE_Morph.prototype.openSpritesString = function (str) {
function () {
msg = myself.showMessage('Opening sprite...');
},
+ function () {nop(); }, // yield (bug in Chrome)
function () {
myself.rawOpenSpritesString(str);
},
@@ -3326,6 +3359,15 @@ IDE_Morph.prototype.toggleAppMode = function (appMode) {
}).forEach(function (s) {
s.adjustScrollBars();
});
+ // prevent rotation and draggability controls from
+ // showing for the stage
+ if (this.currentSprite === this.stage) {
+ this.spriteBar.children.forEach(function (child) {
+ if (child instanceof PushButtonMorph) {
+ child.hide();
+ }
+ });
+ }
}
this.setExtent(this.world().extent()); // resume trackChanges
};
@@ -3502,7 +3544,8 @@ IDE_Morph.prototype.userSetBlocksScale = function () {
sample = new FrameMorph();
sample.acceptsDrops = false;
- sample.texture = this.scriptsPaneTexture;
+ sample.color = IDE_Morph.prototype.groupColor;
+ sample.cachedTexture = this.scriptsPaneTexture;
sample.setExtent(new Point(250, 180));
scrpt.setPosition(sample.position().add(10));
sample.add(scrpt);
@@ -3975,6 +4018,9 @@ IDE_Morph.prototype.cloudResponse = function () {
IDE_Morph.prototype.cloudError = function () {
var myself = this;
+ // try finding an eplanation what's going on
+ // has some issues, commented out for now
+ /*
function getURL(url) {
try {
var request = new XMLHttpRequest();
@@ -3988,13 +4034,15 @@ IDE_Morph.prototype.cloudError = function () {
return null;
}
}
+ */
return function (responseText, url) {
// first, try to find out an explanation for the error
// and notify the user about it,
// if none is found, show an error dialog box
var response = responseText,
- explanation = getURL('http://snap.berkeley.edu/cloudmsg.txt');
+ // explanation = getURL('http://snap.berkeley.edu/cloudmsg.txt'),
+ explanation = null;
if (myself.shield) {
myself.shield.destroy();
myself.shield = null;
@@ -4045,14 +4093,7 @@ IDE_Morph.prototype.setCloudURL = function () {
null,
{
'Snap!Cloud' :
- 'https://snapcloud.miosoft.com/miocon/app/' +
- 'login?_app=SnapCloud',
- 'local network lab' :
- '192.168.2.107:8087/miocon/app/login?_app=SnapCloud',
- 'local network office' :
- '192.168.186.146:8087/miocon/app/login?_app=SnapCloud',
- 'localhost dev' :
- 'localhost/miocon/app/login?_app=SnapCloud'
+ 'https://snap.apps.miosoft.com/SnapCloud'
}
);
};