summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-10-25 12:38:39 +0200
committerjmoenig <jens@moenig.org>2013-10-25 12:38:39 +0200
commitf92b4891c1d95f6f3e1383ef6b03b0c072c46ea5 (patch)
treeb4d9e90a2866be96e624f05addb81bd190ecc800
parent2226f0c92a105bee07e26e0281da5ebba042b792 (diff)
downloadsnap-byow-f92b4891c1d95f6f3e1383ef6b03b0c072c46ea5.tar.gz
snap-byow-f92b4891c1d95f6f3e1383ef6b03b0c072c46ea5.zip
Symbol selection menu for BlockLabelFragmentMorphs
-rw-r--r--byob.js32
-rwxr-xr-xhistory.txt3
2 files changed, 32 insertions, 3 deletions
diff --git a/byob.js b/byob.js
index 82b795d..6815732 100644
--- a/byob.js
+++ b/byob.js
@@ -101,11 +101,12 @@ Context, StringMorph, nop, newCanvas, radians, BoxMorph,
ArrowMorph, PushButtonMorph, contains, InputSlotMorph, ShadowMorph,
ToggleButtonMorph, IDE_Morph, MenuMorph, copy, ToggleElementMorph,
Morph, fontHeight, StageMorph, SyntaxElementMorph, SnapSerializer,
-CommentMorph, localize, CSlotMorph, SpeechBubbleMorph, MorphicPreferences*/
+CommentMorph, localize, CSlotMorph, SpeechBubbleMorph, MorphicPreferences,
+SymbolMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.byob = '2013-October-04';
+modules.byob = '2013-October-25';
// Declarations
@@ -2067,6 +2068,33 @@ BlockLabelFragmentMorph.prototype.updateBlockLabel = function (newFragment) {
}
};
+BlockLabelFragmentMorph.prototype.userMenu = function () {
+ // show a menu of built-in special symbols
+ var myself = this,
+ symbolColor = new Color(100, 100, 130),
+ menu = new MenuMorph(
+ function (string) {
+ var tuple = myself.text.split('-');
+ myself.changed();
+ tuple[0] = '$' + string;
+ myself.text = tuple.join('-');
+ myself.fragment.labelString = myself.text;
+ myself.drawNew();
+ myself.changed();
+ },
+ null,
+ this,
+ this.fontSize
+ );
+ SymbolMorph.prototype.names.forEach(function (name) {
+ menu.addItem(
+ [new SymbolMorph(name, menu.fontSize, symbolColor), name],
+ name
+ );
+ });
+ return menu;
+};
+
// BlockLabelPlaceHolderMorph ///////////////////////////////////////////////
/*
diff --git a/history.txt b/history.txt
index 527d6e8..b47e628 100755
--- a/history.txt
+++ b/history.txt
@@ -1971,4 +1971,5 @@ ______
131025
———
-* Blocks: - enable Costumes as Symbols and Symbols as custom block label parts
+* Blocks: enable Costumes as Symbols and Symbols as custom block label parts
+* BYOB: Symbol selection menu for BlockLabelFragmentMorphs