added indented sub-preferences to the settings menu

snap7
jmoenig 2021-11-24 12:06:47 +01:00
rodzic a74c7a3bd6
commit 11573cb86b
1 zmienionych plików z 17 dodań i 3 usunięć

Wyświetl plik

@ -3786,6 +3786,20 @@ IDE_Morph.prototype.settingsMenu = function () {
} }
} }
function addSubPreference(label, toggle, test, onHint, offHint, hide) {
if (!hide || shiftClicked) {
menu.addItem(
[
(test? on : off),
' ' + localize(label)
],
toggle,
test ? onHint : offHint,
hide ? new Color(100, 0, 0) : null
);
}
}
menu = new MenuMorph(this); menu = new MenuMorph(this);
menu.addPair( menu.addPair(
[ [
@ -3884,7 +3898,7 @@ IDE_Morph.prototype.settingsMenu = function () {
'check to enable\ninput sliders for\nentry fields' 'check to enable\ninput sliders for\nentry fields'
); );
if (MorphicPreferences.useSliderForInput) { if (MorphicPreferences.useSliderForInput) {
addPreference( addSubPreference(
'Execute on slider change', 'Execute on slider change',
'toggleSliderExecute', 'toggleSliderExecute',
ArgMorph.prototype.executeOnSliderEdit, ArgMorph.prototype.executeOnSliderEdit,
@ -4212,14 +4226,14 @@ IDE_Morph.prototype.settingsMenu = function () {
false false
); );
if (this.scene.unifiedPalette) { if (this.scene.unifiedPalette) {
addPreference( addSubPreference(
'Show categories', 'Show categories',
() => this.toggleCategoryNames(), () => this.toggleCategoryNames(),
this.scene.showCategories, this.scene.showCategories,
'uncheck to hide\ncategory names\nin the palette', 'uncheck to hide\ncategory names\nin the palette',
'check to show\ncategory names\nin the palette' 'check to show\ncategory names\nin the palette'
); );
addPreference( addSubPreference(
'Show buttons', 'Show buttons',
() => this.togglePaletteButtons(), () => this.togglePaletteButtons(),
this.scene.showPaletteButtons, this.scene.showPaletteButtons,