enable Symbols in InputSlotDialog Morph’s drop down menu

pull/3/merge
jmoenig 2013-10-25 15:14:20 +02:00
rodzic a810667d8d
commit 5b63e7e6fa
2 zmienionych plików z 19 dodań i 0 usunięć

18
byob.js
Wyświetl plik

@ -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();

Wyświetl plik

@ -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 Morphs drop down menu