summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-10-25 15:14:20 +0200
committerjmoenig <jens@moenig.org>2013-10-25 15:14:20 +0200
commit5b63e7e6fa009fca3cbb8eaf2fc7e629f17d7845 (patch)
tree583d5a7e9863fbe45c00f149f86e336317dce3c9
parenta810667d8d70186da7a045611de0f999937bb7a9 (diff)
downloadsnap-yow-5b63e7e6fa009fca3cbb8eaf2fc7e629f17d7845.tar.gz
snap-yow-5b63e7e6fa009fca3cbb8eaf2fc7e629f17d7845.zip
enable Symbols in InputSlotDialog Morph’s drop down menu
-rw-r--r--byob.js18
-rwxr-xr-xhistory.txt1
2 files changed, 19 insertions, 0 deletions
diff --git a/byob.js b/byob.js
index 6815732..921c3d1 100644
--- a/byob.js
+++ b/byob.js
@@ -2296,6 +2296,7 @@ InputSlotDialogMorph.prototype.init = function (
// additional properties:
this.fragment = fragment || new BlockLabelFragment();
+ this.textfield = null;
this.types = null;
this.slots = null;
this.isExpanded = false;
@@ -2397,6 +2398,8 @@ InputSlotDialogMorph.prototype.addBlockTypeButton
= BlockDialogMorph.prototype.addBlockTypeButton;
InputSlotDialogMorph.prototype.setType = function (fragmentType) {
+ this.textfield.choices = fragmentType ? null : this.symbolMenu;
+ this.textfield.drawNew();
this.fragment.type = fragmentType || null;
this.types.children.forEach(function (c) {
c.refresh();
@@ -2487,6 +2490,7 @@ InputSlotDialogMorph.prototype.open = function (
var txt = new InputFieldMorph(defaultString),
oldFlag = Morph.prototype.trackChanges;
+ txt.choices = this.symbolMenu;
Morph.prototype.trackChanges = false;
this.isExpanded = this.isLaunchingExpanded;
txt.setWidth(250);
@@ -2495,6 +2499,7 @@ InputSlotDialogMorph.prototype.open = function (
if (pic) {this.setPicture(pic); }
this.addBody(txt);
txt.drawNew();
+ this.textfield = txt;
this.addButton('ok', 'OK');
if (!noDeleteButton) {
this.addButton('deleteFragment', 'Delete');
@@ -2509,6 +2514,19 @@ InputSlotDialogMorph.prototype.open = function (
this.changed();
};
+InputSlotDialogMorph.prototype.symbolMenu = function () {
+ var symbols = [],
+ symbolColor = new Color(100, 100, 130),
+ myself = this;
+ SymbolMorph.prototype.names.forEach(function (symbol) {
+ symbols.push([
+ [new SymbolMorph(symbol, myself.fontSize, symbolColor), symbol],
+ '$' + symbol
+ ]);
+ });
+ return symbols;
+};
+
InputSlotDialogMorph.prototype.deleteFragment = function () {
this.fragment.isDeleted = true;
this.accept();
diff --git a/history.txt b/history.txt
index a157723..c2c4531 100755
--- a/history.txt
+++ b/history.txt
@@ -1975,3 +1975,4 @@ ______
* BYOB: Symbol selection menu for BlockLabelFragmentMorphs
* Portuguese translation update
* Widgets: enable Symbols in InputField drop down menus
+* BYOB: enable Symbols in InputSlotDialog Morph’s drop down menu