diff --git a/HISTORY.md b/HISTORY.md index 102e318a..90e0cc7b 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -30,6 +30,9 @@ * **Translation Updates:** * German +### 2022-04-01 +* objects: added ASK-menu data representation for Booleans + ### 2022-03-31 * threads, objects: new menu functionality for ASK command, when passing a list * objects: support various data types inside menus (sprites, costumes, blocks) diff --git a/snap.html b/snap.html index 31013891..fe21bfd0 100755 --- a/snap.html +++ b/snap.html @@ -18,7 +18,7 @@ - + diff --git a/src/objects.js b/src/objects.js index 83a66c19..7a4cd7b5 100644 --- a/src/objects.js +++ b/src/objects.js @@ -93,7 +93,7 @@ BlockVisibilityDialogMorph, CostumeIconMorph, SoundIconMorph, MenuItemMorph*/ /*jshint esversion: 6*/ -modules.objects = '2022-March-31'; +modules.objects = '2022-April-01'; var SpriteMorph; var StageMorph; @@ -12914,6 +12914,7 @@ StagePickerMorph.prototype.isSubmenu = function (options) { }; StagePickerMorph.prototype.dataRepresentation = function (data) { + var sym; switch (Process.prototype.reportTypeOf(data)) { case 'costume': case 'sprite': @@ -12923,11 +12924,48 @@ StagePickerMorph.prototype.dataRepresentation = function (data) { case 'reporter': case 'predicate': return data.image(); + case 'Boolean': + sym = new BooleanSlotMorph(data); + sym.fontSize *= this.scale; + sym.edge *= this.scale; + sym.fixLayout(); + return sym.fullImage(); default: return data.toString(); } }; +StagePickerMorph.prototype.addItem = function ( + labelString, + action, + hint, + color, + bold, // bool + italic, // bool + doubleClickAction, // optional, when used as list contents + shortcut, // optional string, icon (Morph or Canvas) or tuple [icon, string] + verbatim // optional bool, don't translate if true +) { + /* + labelString is normally a single-line string. But it can also be one + of the following: + + * a multi-line string (containing line breaks) + * an icon (either a Morph or a Canvas) + * a tuple of format: [icon, string] + */ + this.items.push([ + verbatim ? labelString : localize(labelString), + action === 0 ? 0 : action || nop, + hint, + color, + bold || false, + italic || false, + doubleClickAction, + shortcut, + verbatim]); +}; + // StagePickerMorph popping up StagePickerMorph.prototype.popup = function (stage, pos) {