allow project-setting “Ternary Boolean slots” to be switched off

default is “on”. That way Boolean input slots can always be toggled
through “true”, “false” and “empty”. If this setting is switched off
Boolean input slots only toggle between “true” and “false” unless
inside a a ring (for implicit parameters)
upd4.1
Jens Mönig 2017-01-23 15:03:47 +01:00
rodzic 55e13caab4
commit 292cc749da
4 zmienionych plików z 25 dodań i 4 usunięć

Wyświetl plik

@ -8824,6 +8824,10 @@ BooleanSlotMorph.prototype = new ArgMorph();
BooleanSlotMorph.prototype.constructor = BooleanSlotMorph; BooleanSlotMorph.prototype.constructor = BooleanSlotMorph;
BooleanSlotMorph.uber = ArgMorph.prototype; BooleanSlotMorph.uber = ArgMorph.prototype;
// BooleanSlotMorph preferences settings
BooleanSlotMorph.prototype.isTernary = true;
// BooleanSlotMorph instance creation: // BooleanSlotMorph instance creation:
function BooleanSlotMorph(initialValue) { function BooleanSlotMorph(initialValue) {
@ -8851,7 +8855,8 @@ BooleanSlotMorph.prototype.isEmptySlot = function () {
}; };
BooleanSlotMorph.prototype.isBinary = function () { BooleanSlotMorph.prototype.isBinary = function () {
return isNil(this.parentThatIsA(RingMorph)) && return !this.isTernary &&
isNil(this.parentThatIsA(RingMorph)) &&
!isNil(this.parentThatIsA(ScriptsMorph)); !isNil(this.parentThatIsA(ScriptsMorph));
}; };

15
gui.js
Wyświetl plik

@ -70,11 +70,11 @@ fontHeight, hex_sha512, sb, CommentMorph, CommandBlockMorph,
BlockLabelPlaceHolderMorph, Audio, SpeechBubbleMorph, ScriptFocusMorph, BlockLabelPlaceHolderMorph, Audio, SpeechBubbleMorph, ScriptFocusMorph,
XML_Element, WatcherMorph, BlockRemovalDialogMorph, saveAs, TableMorph, XML_Element, WatcherMorph, BlockRemovalDialogMorph, saveAs, TableMorph,
isSnapObject, isRetinaEnabled, disableRetinaSupport, enableRetinaSupport, isSnapObject, isRetinaEnabled, disableRetinaSupport, enableRetinaSupport,
isRetinaSupported, SliderMorph, Animation*/ isRetinaSupported, SliderMorph, Animation, BooleanSlotMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.gui = '2017-January-20'; modules.gui = '2017-January-23';
// Declarations // Declarations
@ -2733,6 +2733,16 @@ IDE_Morph.prototype.settingsMenu = function () {
'uncheck for round ends of lines', 'uncheck for round ends of lines',
'check for flat ends of lines' 'check for flat ends of lines'
); );
addPreference(
'Ternary Boolean slots',
function () {
BooleanSlotMorph.prototype.isTernary =
!BooleanSlotMorph.prototype.isTernary;
},
BooleanSlotMorph.prototype.isTernary,
'uncheck to only\ntoggle true / false\noutside of rings',
'check to enable toggling\nBoolean slots to empty'
);
addPreference( addPreference(
'Codification support', 'Codification support',
function () { function () {
@ -3415,6 +3425,7 @@ IDE_Morph.prototype.newProject = function () {
StageMorph.prototype.enableInheritance = false; StageMorph.prototype.enableInheritance = false;
StageMorph.prototype.enableSublistIDs = false; StageMorph.prototype.enableSublistIDs = false;
SpriteMorph.prototype.useFlatLineEnds = false; SpriteMorph.prototype.useFlatLineEnds = false;
BooleanSlotMorph.prototype.isTernary = true;
Process.prototype.enableLiveCoding = false; Process.prototype.enableLiveCoding = false;
this.setProjectName(''); this.setProjectName('');
this.projectNotes = ''; this.projectNotes = '';

Wyświetl plik

@ -3324,4 +3324,5 @@ Fixes:
170123 170123
------ ------
* BYOB, Blocks, Store: added support for default values in custom block Boolean slots * BYOB, Blocks, Store: added support for default values in custom block Boolean slots
* GUI, Blocks, Store: allow project-setting “Ternary Boolean slots” to be switched off

Wyświetl plik

@ -412,6 +412,8 @@ SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode) {
project.stage.setExtent(StageMorph.prototype.dimensions); project.stage.setExtent(StageMorph.prototype.dimensions);
SpriteMorph.prototype.useFlatLineEnds = SpriteMorph.prototype.useFlatLineEnds =
model.stage.attributes.lines === 'flat'; model.stage.attributes.lines === 'flat';
BooleanSlotMorph.prototype.isTernary =
model.stage.attributes.ternary !== 'false';
project.stage.isThreadSafe = project.stage.isThreadSafe =
model.stage.attributes.threadsafe === 'true'; model.stage.attributes.threadsafe === 'true';
StageMorph.prototype.enableCodeMapping = StageMorph.prototype.enableCodeMapping =
@ -1511,6 +1513,7 @@ StageMorph.prototype.toXML = function (serializer) {
'<stage name="@" width="@" height="@" ' + '<stage name="@" width="@" height="@" ' +
'costume="@" tempo="@" threadsafe="@" ' + 'costume="@" tempo="@" threadsafe="@" ' +
'lines="@" ' + 'lines="@" ' +
'ternary="@" ' +
'codify="@" ' + 'codify="@" ' +
'inheritance="@" ' + 'inheritance="@" ' +
'sublistIDs="@" ' + 'sublistIDs="@" ' +
@ -1540,6 +1543,7 @@ StageMorph.prototype.toXML = function (serializer) {
this.getTempo(), this.getTempo(),
this.isThreadSafe, this.isThreadSafe,
SpriteMorph.prototype.useFlatLineEnds ? 'flat' : 'round', SpriteMorph.prototype.useFlatLineEnds ? 'flat' : 'round',
BooleanSlotMorph.prototype.isTernary,
this.enableCodeMapping, this.enableCodeMapping,
this.enableInheritance, this.enableInheritance,
this.enableSublistIDs, this.enableSublistIDs,