summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-05-14 16:16:21 +0200
committerjmoenig <jens@moenig.org>2013-05-14 16:16:21 +0200
commitd267b696af1e7a429c4b31dc87b46dc638c3509f (patch)
tree55ea3f81aa2f60b552ad0a649e58fc2d43debbc9 /blocks.js
parent4c44efdc1e7a2c1bb06274b206de7a982fb03d12 (diff)
downloadsnap-yow-d267b696af1e7a429c4b31dc87b46dc638c3509f.tar.gz
snap-yow-d267b696af1e7a429c4b31dc87b46dc638c3509f.zip
Broadcast & Message enhancements, fixed #93
* When I receive <any msg> option * getLastMessage reporter + watcher
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js38
1 files changed, 35 insertions, 3 deletions
diff --git a/blocks.js b/blocks.js
index dd5fed7..3e32b16 100644
--- a/blocks.js
+++ b/blocks.js
@@ -153,7 +153,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2013-April-30';
+modules.blocks = '2013-May-14';
var SyntaxElementMorph;
var BlockMorph;
@@ -195,7 +195,7 @@ WorldMorph.prototype.customMorphs = function () {
new Color(20, 20, 20)
)
];
-
+*/
/*
var sm = new ScriptsMorph();
sm.setExtent(new Point(800, 600));
@@ -936,7 +936,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
part = new InputSlotMorph(
null,
false,
- 'messagesMenu',
+ 'messagesReceivedMenu',
true
);
part.isStatic = true;
@@ -5734,6 +5734,38 @@ InputSlotMorph.prototype.messagesMenu = function () {
return dict;
};
+InputSlotMorph.prototype.messagesReceivedMenu = function () {
+ var dict = {'any message': ['any message']},
+ rcvr = this.parentThatIsA(BlockMorph).receiver(),
+ stage = rcvr.parentThatIsA(StageMorph),
+ myself = this,
+ allNames = [];
+
+ stage.children.concat(stage).forEach(function (morph) {
+ if (morph instanceof SpriteMorph || morph instanceof StageMorph) {
+ allNames = allNames.concat(morph.allMessageNames());
+ }
+ });
+ allNames.forEach(function (name) {
+ dict[name] = name;
+ });
+ dict['~'] = null;
+ dict['new...'] = function () {
+
+ new DialogBoxMorph(
+ myself,
+ myself.setContents,
+ myself
+ ).prompt(
+ 'Message name',
+ null,
+ myself.world()
+ );
+ };
+
+ return dict;
+};
+
InputSlotMorph.prototype.collidablesMenu = function () {
var dict = {
'mouse-pointer' : ['mouse-pointer'],