kopia lustrzana https://github.com/backface/turtlestitch
refactored IDE settings menu
rodzic
225d2b515a
commit
e04dedd1f5
153
src/gui.js
153
src/gui.js
|
@ -2944,7 +2944,6 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
var menu,
|
var menu,
|
||||||
stage = this.stage,
|
stage = this.stage,
|
||||||
world = this.world(),
|
world = this.world(),
|
||||||
myself = this,
|
|
||||||
pos = this.controlBar.settingsButton.bottomLeft(),
|
pos = this.controlBar.settingsButton.bottomLeft(),
|
||||||
shiftClicked = (world.currentKey === 16);
|
shiftClicked = (world.currentKey === 16);
|
||||||
|
|
||||||
|
@ -2997,11 +2996,11 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
/*
|
/*
|
||||||
addPreference(
|
addPreference(
|
||||||
'JavaScript',
|
'JavaScript',
|
||||||
function () {
|
() => {
|
||||||
Process.prototype.enableJS = !Process.prototype.enableJS;
|
Process.prototype.enableJS = !Process.prototype.enableJS;
|
||||||
myself.currentSprite.blocksCache.operators = null;
|
this.currentSprite.blocksCache.operators = null;
|
||||||
myself.currentSprite.paletteCache.operators = null;
|
this.currentSprite.paletteCache.operators = null;
|
||||||
myself.refreshPalette();
|
this.refreshPalette();
|
||||||
},
|
},
|
||||||
Process.prototype.enableJS,
|
Process.prototype.enableJS,
|
||||||
'uncheck to disable support for\nnative JavaScript functions',
|
'uncheck to disable support for\nnative JavaScript functions',
|
||||||
|
@ -3051,10 +3050,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Log pen vectors',
|
'Log pen vectors',
|
||||||
function () {
|
() => StageMorph.prototype.enablePenLogging =
|
||||||
StageMorph.prototype.enablePenLogging =
|
!StageMorph.prototype.enablePenLogging,
|
||||||
!StageMorph.prototype.enablePenLogging;
|
|
||||||
},
|
|
||||||
StageMorph.prototype.enablePenLogging,
|
StageMorph.prototype.enablePenLogging,
|
||||||
'uncheck to turn off\nlogging pen vectors',
|
'uncheck to turn off\nlogging pen vectors',
|
||||||
'check to turn on\nlogging pen vectors',
|
'check to turn on\nlogging pen vectors',
|
||||||
|
@ -3062,10 +3059,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Ternary Boolean slots',
|
'Ternary Boolean slots',
|
||||||
function () {
|
() => BooleanSlotMorph.prototype.isTernary =
|
||||||
BooleanSlotMorph.prototype.isTernary =
|
!BooleanSlotMorph.prototype.isTernary,
|
||||||
!BooleanSlotMorph.prototype.isTernary;
|
|
||||||
},
|
|
||||||
BooleanSlotMorph.prototype.isTernary,
|
BooleanSlotMorph.prototype.isTernary,
|
||||||
'uncheck to limit\nBoolean slots to true / false',
|
'uncheck to limit\nBoolean slots to true / false',
|
||||||
'check to allow\nempty Boolean slots',
|
'check to allow\nempty Boolean slots',
|
||||||
|
@ -3136,12 +3131,12 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Clicking sound',
|
'Clicking sound',
|
||||||
function () {
|
() => {
|
||||||
BlockMorph.prototype.toggleSnapSound();
|
BlockMorph.prototype.toggleSnapSound();
|
||||||
if (BlockMorph.prototype.snapSound) {
|
if (BlockMorph.prototype.snapSound) {
|
||||||
myself.saveSetting('click', true);
|
this.saveSetting('click', true);
|
||||||
} else {
|
} else {
|
||||||
myself.removeSetting('click');
|
this.removeSetting('click');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BlockMorph.prototype.snapSound,
|
BlockMorph.prototype.snapSound,
|
||||||
|
@ -3150,15 +3145,15 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Animations',
|
'Animations',
|
||||||
function () {myself.isAnimating = !myself.isAnimating; },
|
() => this.isAnimating = !this.isAnimating,
|
||||||
myself.isAnimating,
|
this.isAnimating,
|
||||||
'uncheck to disable\nIDE animations',
|
'uncheck to disable\nIDE animations',
|
||||||
'check to enable\nIDE animations',
|
'check to enable\nIDE animations',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Cache Inputs',
|
'Cache Inputs',
|
||||||
function () {
|
() => {
|
||||||
BlockMorph.prototype.isCachingInputs =
|
BlockMorph.prototype.isCachingInputs =
|
||||||
!BlockMorph.prototype.isCachingInputs;
|
!BlockMorph.prototype.isCachingInputs;
|
||||||
},
|
},
|
||||||
|
@ -3169,10 +3164,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Rasterize SVGs',
|
'Rasterize SVGs',
|
||||||
function () {
|
() => MorphicPreferences.rasterizeSVGs =
|
||||||
MorphicPreferences.rasterizeSVGs =
|
!MorphicPreferences.rasterizeSVGs,
|
||||||
!MorphicPreferences.rasterizeSVGs;
|
|
||||||
},
|
|
||||||
MorphicPreferences.rasterizeSVGs,
|
MorphicPreferences.rasterizeSVGs,
|
||||||
'uncheck for smooth\nscaling of vector costumes',
|
'uncheck for smooth\nscaling of vector costumes',
|
||||||
'check to rasterize\nSVGs on import',
|
'check to rasterize\nSVGs on import',
|
||||||
|
@ -3180,11 +3173,11 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Flat design',
|
'Flat design',
|
||||||
function () {
|
() => {
|
||||||
if (MorphicPreferences.isFlat) {
|
if (MorphicPreferences.isFlat) {
|
||||||
return myself.defaultDesign();
|
return this.defaultDesign();
|
||||||
}
|
}
|
||||||
myself.flatDesign();
|
this.flatDesign();
|
||||||
},
|
},
|
||||||
MorphicPreferences.isFlat,
|
MorphicPreferences.isFlat,
|
||||||
'uncheck for default\nGUI design',
|
'uncheck for default\nGUI design',
|
||||||
|
@ -3193,13 +3186,13 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Nested auto-wrapping',
|
'Nested auto-wrapping',
|
||||||
function () {
|
() => {
|
||||||
ScriptsMorph.prototype.enableNestedAutoWrapping =
|
ScriptsMorph.prototype.enableNestedAutoWrapping =
|
||||||
!ScriptsMorph.prototype.enableNestedAutoWrapping;
|
!ScriptsMorph.prototype.enableNestedAutoWrapping;
|
||||||
if (ScriptsMorph.prototype.enableNestedAutoWrapping) {
|
if (ScriptsMorph.prototype.enableNestedAutoWrapping) {
|
||||||
myself.removeSetting('autowrapping');
|
this.removeSetting('autowrapping');
|
||||||
} else {
|
} else {
|
||||||
myself.saveSetting('autowrapping', false);
|
this.saveSetting('autowrapping', false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ScriptsMorph.prototype.enableNestedAutoWrapping,
|
ScriptsMorph.prototype.enableNestedAutoWrapping,
|
||||||
|
@ -3209,25 +3202,23 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Project URLs',
|
'Project URLs',
|
||||||
function () {
|
() => {
|
||||||
myself.projectsInURLs = !myself.projectsInURLs;
|
this.projectsInURLs = !this.projectsInURLs;
|
||||||
if (myself.projectsInURLs) {
|
if (this.projectsInURLs) {
|
||||||
myself.saveSetting('longurls', true);
|
this.saveSetting('longurls', true);
|
||||||
} else {
|
} else {
|
||||||
myself.removeSetting('longurls');
|
this.removeSetting('longurls');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
myself.projectsInURLs,
|
this.projectsInURLs,
|
||||||
'uncheck to disable\nproject data in URLs',
|
'uncheck to disable\nproject data in URLs',
|
||||||
'check to enable\nproject data in URLs',
|
'check to enable\nproject data in URLs',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Sprite Nesting',
|
'Sprite Nesting',
|
||||||
function () {
|
() => SpriteMorph.prototype.enableNesting =
|
||||||
SpriteMorph.prototype.enableNesting =
|
!SpriteMorph.prototype.enableNesting,
|
||||||
!SpriteMorph.prototype.enableNesting;
|
|
||||||
},
|
|
||||||
SpriteMorph.prototype.enableNesting,
|
SpriteMorph.prototype.enableNesting,
|
||||||
'uncheck to disable\nsprite composition',
|
'uncheck to disable\nsprite composition',
|
||||||
'check to enable\nsprite composition',
|
'check to enable\nsprite composition',
|
||||||
|
@ -3235,12 +3226,12 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'First-Class Sprites',
|
'First-Class Sprites',
|
||||||
function () {
|
() => {
|
||||||
SpriteMorph.prototype.enableFirstClass =
|
SpriteMorph.prototype.enableFirstClass =
|
||||||
!SpriteMorph.prototype.enableFirstClass;
|
!SpriteMorph.prototype.enableFirstClass;
|
||||||
myself.currentSprite.blocksCache.sensing = null;
|
this.currentSprite.blocksCache.sensing = null;
|
||||||
myself.currentSprite.paletteCache.sensing = null;
|
this.currentSprite.paletteCache.sensing = null;
|
||||||
myself.refreshPalette();
|
this.refreshPalette();
|
||||||
},
|
},
|
||||||
SpriteMorph.prototype.enableFirstClass,
|
SpriteMorph.prototype.enableFirstClass,
|
||||||
'uncheck to disable support\nfor first-class sprites',
|
'uncheck to disable support\nfor first-class sprites',
|
||||||
|
@ -3249,14 +3240,14 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Keyboard Editing',
|
'Keyboard Editing',
|
||||||
function () {
|
() => {
|
||||||
ScriptsMorph.prototype.enableKeyboard =
|
ScriptsMorph.prototype.enableKeyboard =
|
||||||
!ScriptsMorph.prototype.enableKeyboard;
|
!ScriptsMorph.prototype.enableKeyboard;
|
||||||
myself.currentSprite.scripts.updateToolbar();
|
this.currentSprite.scripts.updateToolbar();
|
||||||
if (ScriptsMorph.prototype.enableKeyboard) {
|
if (ScriptsMorph.prototype.enableKeyboard) {
|
||||||
myself.removeSetting('keyboard');
|
this.removeSetting('keyboard');
|
||||||
} else {
|
} else {
|
||||||
myself.saveSetting('keyboard', false);
|
this.saveSetting('keyboard', false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ScriptsMorph.prototype.enableKeyboard,
|
ScriptsMorph.prototype.enableKeyboard,
|
||||||
|
@ -3266,13 +3257,13 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Table support',
|
'Table support',
|
||||||
function () {
|
() => {
|
||||||
List.prototype.enableTables =
|
List.prototype.enableTables =
|
||||||
!List.prototype.enableTables;
|
!List.prototype.enableTables;
|
||||||
if (List.prototype.enableTables) {
|
if (List.prototype.enableTables) {
|
||||||
myself.removeSetting('tables');
|
this.removeSetting('tables');
|
||||||
} else {
|
} else {
|
||||||
myself.saveSetting('tables', false);
|
this.saveSetting('tables', false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
List.prototype.enableTables,
|
List.prototype.enableTables,
|
||||||
|
@ -3283,13 +3274,13 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
if (List.prototype.enableTables) {
|
if (List.prototype.enableTables) {
|
||||||
addPreference(
|
addPreference(
|
||||||
'Table lines',
|
'Table lines',
|
||||||
function () {
|
() => {
|
||||||
TableMorph.prototype.highContrast =
|
TableMorph.prototype.highContrast =
|
||||||
!TableMorph.prototype.highContrast;
|
!TableMorph.prototype.highContrast;
|
||||||
if (TableMorph.prototype.highContrast) {
|
if (TableMorph.prototype.highContrast) {
|
||||||
myself.saveSetting('tableLines', true);
|
this.saveSetting('tableLines', true);
|
||||||
} else {
|
} else {
|
||||||
myself.removeSetting('tableLines');
|
this.removeSetting('tableLines');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TableMorph.prototype.highContrast,
|
TableMorph.prototype.highContrast,
|
||||||
|
@ -3300,10 +3291,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
}
|
}
|
||||||
addPreference(
|
addPreference(
|
||||||
'Live coding support',
|
'Live coding support',
|
||||||
function () {
|
() => Process.prototype.enableLiveCoding =
|
||||||
Process.prototype.enableLiveCoding =
|
!Process.prototype.enableLiveCoding,
|
||||||
!Process.prototype.enableLiveCoding;
|
|
||||||
},
|
|
||||||
Process.prototype.enableLiveCoding,
|
Process.prototype.enableLiveCoding,
|
||||||
'EXPERIMENTAL! uncheck to disable live\ncustom control structures',
|
'EXPERIMENTAL! uncheck to disable live\ncustom control structures',
|
||||||
'EXPERIMENTAL! check to enable\n live custom control structures',
|
'EXPERIMENTAL! check to enable\n live custom control structures',
|
||||||
|
@ -3311,12 +3300,12 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'JIT compiler support',
|
'JIT compiler support',
|
||||||
function () {
|
() => {
|
||||||
Process.prototype.enableCompiling =
|
Process.prototype.enableCompiling =
|
||||||
!Process.prototype.enableCompiling;
|
!Process.prototype.enableCompiling;
|
||||||
myself.currentSprite.blocksCache.operators = null;
|
this.currentSprite.blocksCache.operators = null;
|
||||||
myself.currentSprite.paletteCache.operators = null;
|
this.currentSprite.paletteCache.operators = null;
|
||||||
myself.refreshPalette();
|
this.refreshPalette();
|
||||||
},
|
},
|
||||||
Process.prototype.enableCompiling,
|
Process.prototype.enableCompiling,
|
||||||
'EXPERIMENTAL! uncheck to disable live\nsupport for compiling',
|
'EXPERIMENTAL! uncheck to disable live\nsupport for compiling',
|
||||||
|
@ -3326,7 +3315,7 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
menu.addLine(); // everything below this line is stored in the project
|
menu.addLine(); // everything below this line is stored in the project
|
||||||
addPreference(
|
addPreference(
|
||||||
'Thread safe scripts',
|
'Thread safe scripts',
|
||||||
function () {stage.isThreadSafe = !stage.isThreadSafe; },
|
() => stage.isThreadSafe = !stage.isThreadSafe,
|
||||||
this.stage.isThreadSafe,
|
this.stage.isThreadSafe,
|
||||||
'uncheck to allow\nscript reentrance',
|
'uncheck to allow\nscript reentrance',
|
||||||
'check to disallow\nscript reentrance'
|
'check to disallow\nscript reentrance'
|
||||||
|
@ -3341,22 +3330,20 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Flat line ends',
|
'Flat line ends',
|
||||||
function () {
|
() => SpriteMorph.prototype.useFlatLineEnds =
|
||||||
SpriteMorph.prototype.useFlatLineEnds =
|
!SpriteMorph.prototype.useFlatLineEnds,
|
||||||
!SpriteMorph.prototype.useFlatLineEnds;
|
|
||||||
},
|
|
||||||
SpriteMorph.prototype.useFlatLineEnds,
|
SpriteMorph.prototype.useFlatLineEnds,
|
||||||
'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(
|
addPreference(
|
||||||
'Codification support',
|
'Codification support',
|
||||||
function () {
|
() => {
|
||||||
StageMorph.prototype.enableCodeMapping =
|
StageMorph.prototype.enableCodeMapping =
|
||||||
!StageMorph.prototype.enableCodeMapping;
|
!StageMorph.prototype.enableCodeMapping;
|
||||||
myself.currentSprite.blocksCache.variables = null;
|
this.currentSprite.blocksCache.variables = null;
|
||||||
myself.currentSprite.paletteCache.variables = null;
|
this.currentSprite.paletteCache.variables = null;
|
||||||
myself.refreshPalette();
|
this.refreshPalette();
|
||||||
},
|
},
|
||||||
StageMorph.prototype.enableCodeMapping,
|
StageMorph.prototype.enableCodeMapping,
|
||||||
'uncheck to disable\nblock to text mapping features',
|
'uncheck to disable\nblock to text mapping features',
|
||||||
|
@ -3365,12 +3352,12 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Inheritance support',
|
'Inheritance support',
|
||||||
function () {
|
() => {
|
||||||
StageMorph.prototype.enableInheritance =
|
StageMorph.prototype.enableInheritance =
|
||||||
!StageMorph.prototype.enableInheritance;
|
!StageMorph.prototype.enableInheritance;
|
||||||
myself.currentSprite.blocksCache.variables = null;
|
this.currentSprite.blocksCache.variables = null;
|
||||||
myself.currentSprite.paletteCache.variables = null;
|
this.currentSprite.paletteCache.variables = null;
|
||||||
myself.refreshPalette();
|
this.refreshPalette();
|
||||||
},
|
},
|
||||||
StageMorph.prototype.enableInheritance,
|
StageMorph.prototype.enableInheritance,
|
||||||
'uncheck to disable\nsprite inheritance features',
|
'uncheck to disable\nsprite inheritance features',
|
||||||
|
@ -3379,10 +3366,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Hyper blocks support',
|
'Hyper blocks support',
|
||||||
function () {
|
() => Process.prototype.enableHyperOps =
|
||||||
Process.prototype.enableHyperOps =
|
!Process.prototype.enableHyperOps,
|
||||||
!Process.prototype.enableHyperOps;
|
|
||||||
},
|
|
||||||
Process.prototype.enableHyperOps,
|
Process.prototype.enableHyperOps,
|
||||||
'uncheck to disable\nusing operators on lists and tables',
|
'uncheck to disable\nusing operators on lists and tables',
|
||||||
'check to enable\nusing operators on lists and tables',
|
'check to enable\nusing operators on lists and tables',
|
||||||
|
@ -3390,10 +3375,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Persist linked sublist IDs',
|
'Persist linked sublist IDs',
|
||||||
function () {
|
() => StageMorph.prototype.enableSublistIDs =
|
||||||
StageMorph.prototype.enableSublistIDs =
|
!StageMorph.prototype.enableSublistIDs,
|
||||||
!StageMorph.prototype.enableSublistIDs;
|
|
||||||
},
|
|
||||||
StageMorph.prototype.enableSublistIDs,
|
StageMorph.prototype.enableSublistIDs,
|
||||||
'uncheck to disable\nsaving linked sublist identities',
|
'uncheck to disable\nsaving linked sublist identities',
|
||||||
'check to enable\nsaving linked sublist identities',
|
'check to enable\nsaving linked sublist identities',
|
||||||
|
@ -3401,10 +3384,8 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
);
|
);
|
||||||
addPreference(
|
addPreference(
|
||||||
'Enable command drops in all rings',
|
'Enable command drops in all rings',
|
||||||
function () {
|
() => RingReporterSlotMorph.prototype.enableCommandDrops =
|
||||||
RingReporterSlotMorph.prototype.enableCommandDrops =
|
!RingReporterSlotMorph.prototype.enableCommandDrops,
|
||||||
!RingReporterSlotMorph.prototype.enableCommandDrops;
|
|
||||||
},
|
|
||||||
RingReporterSlotMorph.prototype.enableCommandDrops,
|
RingReporterSlotMorph.prototype.enableCommandDrops,
|
||||||
'uncheck to disable\ndropping commands in reporter rings',
|
'uncheck to disable\ndropping commands in reporter rings',
|
||||||
'check to enable\ndropping commands in all rings',
|
'check to enable\ndropping commands in all rings',
|
||||||
|
|
Ładowanie…
Reference in New Issue