summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blocks.js3
-rw-r--r--gui.js22
-rwxr-xr-xhistory.txt16
-rw-r--r--morphic.js75
-rw-r--r--threads.js23
5 files changed, 103 insertions, 36 deletions
diff --git a/blocks.js b/blocks.js
index 159d1a2..68a5e70 100644
--- a/blocks.js
+++ b/blocks.js
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2014-June-06';
+modules.blocks = '2014-July-06';
var SyntaxElementMorph;
@@ -2110,6 +2110,7 @@ BlockMorph.prototype.userMenu = function () {
if (this.parentThatIsA(RingMorph)) {
menu.addLine();
menu.addItem("unringify", 'unringify');
+ menu.addItem("ringify", 'ringify');
return menu;
}
if (this.parent instanceof ReporterSlotMorph
diff --git a/gui.js b/gui.js
index 83aa666..d1cac6c 100644
--- a/gui.js
+++ b/gui.js
@@ -69,7 +69,7 @@ SpeechBubbleMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.gui = '2014-Jun-04';
+modules.gui = '2014-July-08';
// Declarations
@@ -922,6 +922,8 @@ IDE_Morph.prototype.createSpriteBar = function () {
tabColors = this.tabColors,
tabBar = new AlignmentMorph('row', -tabCorner * 2),
tab,
+ symbols = ['\u2192', '\u21BB', '\u2194'],
+ labels = ['don\'t rotate', 'can rotate', 'only face left/right'],
myself = this;
if (this.spriteBar) {
@@ -950,17 +952,13 @@ IDE_Morph.prototype.createSpriteBar = function () {
each.refresh();
});
},
- ['\u2192', '\u21BB', '\u2194'][rotationStyle], // label
+ symbols[rotationStyle], // label
function () { // query
return myself.currentSprite instanceof SpriteMorph
&& myself.currentSprite.rotationStyle === rotationStyle;
},
null, // environment
- localize(
- [
- 'don\'t rotate', 'can rotate', 'only face left/right'
- ][rotationStyle]
- )
+ localize(labels[rotationStyle])
);
button.corner = 8;
@@ -1945,7 +1943,7 @@ IDE_Morph.prototype.cloudMenu = function () {
);
} else {
menu.addItem(
- 'Logout',
+ localize('Logout') + ' ' + SnapCloud.username,
'logout'
);
menu.addItem(
@@ -4834,9 +4832,13 @@ ProjectDialogMorph.prototype.shareProject = function () {
function () {
SnapCloud.disconnect();
proj.Public = 'true';
+ myself.unshareButton.show();
+ myself.shareButton.hide();
entry.label.isBold = true;
entry.label.drawNew();
entry.label.changed();
+ myself.buttons.fixLayout();
+ myself.drawNew();
myself.ide.showMessage('shared.', 2);
},
myself.ide.cloudError(),
@@ -4871,9 +4873,13 @@ ProjectDialogMorph.prototype.unshareProject = function () {
function () {
SnapCloud.disconnect();
proj.Public = 'false';
+ myself.shareButton.show();
+ myself.unshareButton.hide();
entry.label.isBold = false;
entry.label.drawNew();
entry.label.changed();
+ myself.buttons.fixLayout();
+ myself.drawNew();
myself.ide.showMessage('unshared.', 2);
},
myself.ide.cloudError(),
diff --git a/history.txt b/history.txt
index 02fc2a0..343a081 100755
--- a/history.txt
+++ b/history.txt
@@ -2166,3 +2166,19 @@ ______
* Blocks: enable relabelling blocks across categories
* Objects: more relabelling options for SAY, THINK, ASK
* BYOB, Blocks: relabelling custom blocks (experimental)
+
+140623
+------
+* Morphic: Inspector enhancements (dynamic property update, keyboard shortcuts)
+* GUI: update visibility of share/unshare buttons, Thanks, Kunal!
+
+140706
+------
+* Blocks: add “ringify” to every context menu that already has “unringify”
+
+
+140708
+------
+* Threads: show error messages for custom blocks (propagating to the script’s top block)
+* Threads: adjust to Doug Crockford’s latest infuriating nitpickings in JSLint
+* GUI: show username in ‘logout’ entry of cloud menu
diff --git a/morphic.js b/morphic.js
index 7d1f53d..3aa5972 100644
--- a/morphic.js
+++ b/morphic.js
@@ -1035,7 +1035,7 @@
/*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio,
FileList, getBlurredShadowSupport*/
-var morphicVersion = '2014-May-20';
+var morphicVersion = '2014-June-23';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@@ -4761,8 +4761,17 @@ CursorMorph.prototype.ctrl = function (aChar) {
this.insert(']');
} else if (aChar === 64) {
this.insert('@');
+ } else if (!isNil(this.target.receiver)) {
+ if (aChar === 68) {
+ this.target.doIt();
+ } else if (aChar === 73) {
+ this.target.inspectIt();
+ } else if (aChar === 80) {
+ this.target.showIt();
+ }
}
+
};
CursorMorph.prototype.cmd = function (aChar) {
@@ -4770,6 +4779,14 @@ CursorMorph.prototype.cmd = function (aChar) {
this.target.selectAll();
} else if (aChar === 90) {
this.undo();
+ } else if (!isNil(this.target.receiver)) {
+ if (aChar === 68) {
+ this.target.doIt();
+ } else if (aChar === 73) {
+ this.target.inspectIt();
+ } else if (aChar === 80) {
+ this.target.showIt();
+ }
}
};
@@ -6157,6 +6174,7 @@ InspectorMorph.prototype.init = function (target) {
this.edge = MorphicPreferences.isFlat ? 1 : 5;
this.color = new Color(60, 60, 60);
this.borderColor = new Color(95, 95, 95);
+ this.fps = 25;
this.drawNew();
// panes:
@@ -6181,6 +6199,28 @@ InspectorMorph.prototype.setTarget = function (target) {
this.buildPanes();
};
+InspectorMorph.prototype.updateCurrentSelection = function () {
+ var val, txt, cnts,
+ sel = this.list.selected;
+
+ if (isNil(sel)) {return; }
+ val = this.target[sel];
+ this.currentProperty = val;
+ if (isNil(val)) {
+ txt = 'NULL';
+ } else if (isString(val)) {
+ txt = val;
+ } else {
+ txt = val.toString();
+ }
+ if (this.detail.contents.children[0].text === txt) {return; }
+ cnts = new TextMorph(txt);
+ cnts.isEditable = true;
+ cnts.enableSelecting();
+ cnts.setReceiver(this.target);
+ this.detail.setContents(cnts);
+};
+
InspectorMorph.prototype.buildPanes = function () {
var attribs = [], property, myself = this, ctrl, ev, doubleClickAction;
@@ -6248,23 +6288,8 @@ InspectorMorph.prototype.buildPanes = function () {
doubleClickAction
);
- this.list.action = function (selected) {
- var val, txt, cnts;
- if (selected === undefined) {return; }
- val = myself.target[selected];
- myself.currentProperty = val;
- if (val === null) {
- txt = 'NULL';
- } else if (isString(val)) {
- txt = val;
- } else {
- txt = val.toString();
- }
- cnts = new TextMorph(txt);
- cnts.isEditable = true;
- cnts.enableSelecting();
- cnts.setReceiver(myself.target);
- myself.detail.setContents(cnts);
+ this.list.action = function () {
+ myself.updateCurrentSelection();
};
this.list.hBar.alpha = 0.6;
@@ -6582,6 +6607,17 @@ InspectorMorph.prototype.removeProperty = function () {
}
};
+// InspectorMorph stepping
+
+InspectorMorph.prototype.step = function () {
+ this.updateCurrentSelection();
+ var lbl = this.target.toString();
+ if (this.label.text === lbl) {return; }
+ this.label.text = lbl;
+ this.label.drawNew();
+ this.fixLayout();
+};
+
// MenuMorph ///////////////////////////////////////////////////////////
// MenuMorph: referenced constructors
@@ -7924,7 +7960,7 @@ TextMorph.prototype.inspectIt = function () {
var result = this.receiver.evaluateString(this.selection()),
world = this.world(),
inspector;
- if (result !== null) {
+ if (isObject(result)) {
inspector = new InspectorMorph(result);
inspector.setPosition(world.hand.position());
inspector.keepWithin(world);
@@ -9046,6 +9082,7 @@ ListMorph.prototype.buildListContents = function () {
};
ListMorph.prototype.select = function (item, trigger) {
+ if (isNil(item)) {return; }
this.selected = item;
this.active = trigger;
if (this.action) {
diff --git a/threads.js b/threads.js
index d489441..1ad18b9 100644
--- a/threads.js
+++ b/threads.js
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff ////////////////////////////////////////////////////////
-modules.threads = '2014-Jun-05';
+modules.threads = '2014-July-08';
var ThreadManager;
var Process;
@@ -673,11 +673,13 @@ Process.prototype.doYield = function () {
// Process Exception Handling
Process.prototype.handleError = function (error, element) {
+ var m = element;
this.stop();
this.errorFlag = true;
this.topBlock.addErrorHighlight();
- (element || this.topBlock).showBubble(
- (element ? '' : 'Inside: ')
+ if (isNil(m) || isNil(m.world())) {m = this.topBlock; }
+ m.showBubble(
+ (m === element ? '' : 'Inside: ')
+ error.name
+ '\n'
+ error.message
@@ -996,6 +998,8 @@ Process.prototype.evaluateCustomBlock = function () {
runnable,
extra,
i,
+ inp,
+ decs,
value,
upvars,
outer;
@@ -1029,17 +1033,19 @@ Process.prototype.evaluateCustomBlock = function () {
if (!isNil(parms[i])) {
value = parms[i];
}
- outer.variables.addVar(context.inputs[i], value);
+ inp = context.inputs[i];
+ outer.variables.addVar(inp, value);
// if the parameter is an upvar,
// create an UpvarReference to it
- if (declarations[context.inputs[i]][0] === '%upvar') {
+ decs = declarations[inp];
+ if (decs[0] === '%upvar') {
if (!upvars) { // lazy initialization
upvars = new UpvarReference(this.context.upvars);
}
upvars.addReference(
value,
- context.inputs[i],
+ inp,
outer.variables
);
}
@@ -3156,8 +3162,9 @@ UpvarReference.prototype.find = function (name) {
};
UpvarReference.prototype.getVar = function (name) {
- var varName = this.vars[name][0],
- varFrame = this.vars[name][1],
+ var tuple = this.vars[name],
+ varName = tuple[0],
+ varFrame = tuple[1],
value = varFrame.vars[varName];
return (value === 0 ? 0 : value || 0); // don't return null
};