kopia lustrzana https://github.com/backface/turtlestitch
Restore Eisenbergification library to library list; fix ide.savingPreferences setting.
rodzic
bc0336b7e3
commit
e4169b6e8d
|
@ -0,0 +1,47 @@
|
|||
<blocks app="Snap! 4.0, http://snap.berkeley.edu" version="1"><block-definition s="setting %'which'" type="reporter" category="sensing"><header></header><code></code><inputs><input type="%s" readonly="true"><options>Project notes
|
||||
Project name
|
||||
User
|
||||
Presentation mode
|
||||
Language
|
||||
Zoom blocks
|
||||
Stage size
|
||||
Stage scale
|
||||
Retina display support
|
||||
Long form input dialog
|
||||
Plain prototype labels
|
||||
Input sliders
|
||||
Execute on slider change
|
||||
Clicking sound
|
||||
Turbo mode
|
||||
Flat design
|
||||
Keyboard editing
|
||||
Table support
|
||||
Table lines
|
||||
Visible stepping
|
||||
Thread safe scripts
|
||||
Prefer smooth animations
|
||||
Flat line ends
|
||||
Codification support
|
||||
Inheritance support</options></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>which</l></list><l>var stage = this.parentThatIsA(StageMorph),
 ide = stage.parentThatIsA(IDE_Morph),
 world = stage.parentThatIsA(WorldMorph);

switch (which) {
 case 'Project notes':
 return ide.projectNotes;
 case 'Project name':
 return ide.projectName;
 case 'User':
 return SnapCloud.username;
 case 'Presentation mode':
 return ide.isAppMode;
 case 'Language':
 return SnapTranslator.language;
 case 'Zoom blocks':
 return SyntaxElementMorph.prototype.scale;
 case 'Stage size':
 return new List([StageMorph.prototype.dimensions.x,
 StageMorph.prototype.dimensions.y]);
 case 'Stage scale':
 return stage.scale;
 case 'Retina display support':
 return isRetinaEnabled();
 case 'Long form input dialog':
 return InputSlotDialogMorph.prototype.isLaunchingExpanded;
 case 'Plain prototype labels':
 return BlockLabelPlaceHolderMorph.prototype.plainLabel;
 case 'Input sliders':
 return MorphicPreferences.useSliderForInput;
 case 'Execute on slider change':
 return ArgMorph.prototype.executeOnSliderEdit;
 case 'Clicking sound':
 return !!BlockMorph.prototype.snapSound;
 case 'Turbo mode':
 return stage.isFastTracked;
 case 'Flat design':
 return MorphicPreferences.isFlat;
 case 'Keyboard editing':
 return ScriptsMorph.prototype.enableKeyboard;
 case 'Table support':
 return List.prototype.enableTables;
 case 'Table lines':
 return TableMorph.prototype.highContrast;
 case 'Visible stepping':
 return Process.prototype.enableSingleStepping;
 case 'Thread safe scripts':
 return stage.isThreadSafe;
 case 'Prefer smooth animations':
 return StageMorph.prototype.frameRate > 0;
 case 'Flat line ends':
 return SpriteMorph.prototype.useFlatLineEnds;
 case 'Codification support':
 return StageMorph.prototype.enableCodeMapping;
 case 'Inheritance support':
 return StageMorph.prototype.enableInheritance;
 default: return which;
}</l></block><list><block var="which"/></list></block></block></script></block-definition><block-definition s="set flag %'which' to %'tf'" type="command" category="sensing"><header></header><code></code><inputs><input type="%s" readonly="true"><options>Presentation mode
|
||||
Retina display support
|
||||
Long form input dialog
|
||||
Plain prototype labels
|
||||
Input sliders
|
||||
Execute on slider change
|
||||
Clicking sound
|
||||
Turbo mode
|
||||
Flat design
|
||||
Keyboard editing
|
||||
Table support
|
||||
Table lines
|
||||
Visible stepping
|
||||
Thread safe scripts
|
||||
Prefer smooth animations
|
||||
Flat line ends
|
||||
Codification support
|
||||
Inheritance support</options></input><input type="%b"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>which</l><l>tf</l></list><l>var stage = this.parentThatIsA(StageMorph),
 ide = stage.parentThatIsA(IDE_Morph),
 world = stage.parentThatIsA(WorldMorph);

if (tf != !!tf) return;

try{
ide.savingPreferences = false;

switch (which) {
 case 'Presentation mode':
 if (tf != ide.isAppMode) ide.toggleAppMode();
 break;
 case 'Retina display support':
 if (tf != isRetinaEnabled()) ide.toggleRetina();
 break;
 case 'Long form input dialog':
 if (tf != InputSlotDialogMorph.prototype.isLaunchingExpanded)
 ide.toggleLongFormInputDialog();
 break;
 case 'Plain prototype labels':
 if (tf != BlockLabelPlaceHolderMorph.prototype.plainLabel)
 ide.togglePlainPrototypeLabels();
 break;
 case 'Input sliders':
 MorphicPreferences.useSliderForInput = tf;
 break;
 case 'Execute on slider change':
 ArgMorph.prototype.executeOnSliderEdit = tf;
 break;
 case 'Clicking sound':
 if (tf != !!BlockMorph.prototype.snapSound)
 BlockMorph.prototype.toggleSnapSound();
 break;
 case 'Turbo mode':
 if (tf != stage.isFastTracked)
 ide.toggleFastTracking();
 break;
 case 'Flat design':
 if (tf == MorphicPreferences.isFlat) break;
 if (tf)
 ide.flatDesign();
 else
 ide.defaultDesign();
 break;
 case 'Keyboard editing':
 ScriptsMorph.prototype.enableKeyboard = tf;
 break;
 case 'Table support':
 List.prototype.enableTables = tf;
 break;
 case 'Table lines':
 TableMorph.prototype.highContrast = tf;
 break;
 case 'Visible stepping':
 if (tf != Process.prototype.enableSingleStepping)
 ide.toggleSingleStepping();
 break;
 case 'Thread safe scripts':
 stage.isThreadSafe = tf;
 break;
 case 'Prefer smooth animations':
 if (tf != (StageMorph.prototype.frameRate > 0))
 ide.toggleVariableFrameRate();
 break;
 case 'Flat line ends':
 SpriteMorph.prototype.useFlatLineEnds = tf;
 break;
 case 'Codification support':
 if (tf != StageMorph.prototype.enableCodeMapping) {
 StageMorph.prototype.enableCodeMapping = tf;
 ide.currentSprite.blocksCache.variables = null;
 ide.currentSprite.paletteCache.variables = null;
 ide.refreshPalette();
 }
 break;
 case 'Inheritance support':
 if (tf != StageMorph.prototype.enableInheritance) {
 StageMorph.prototype.enableInheritance = tf;
 ide.currentSprite.blocksCache.variables = null;
 ide.currentSprite.paletteCache.variables = null;
 ide.refreshPalette();
 }
 break;
};
}
finally {
ide.savingPreferences = false;
};
</l></block><list><block var="which"/><block var="tf"/></list></block></script></block-definition><block-definition s="set value %'which' to %'value'" type="command" category="sensing"><header></header><code></code><inputs><input type="%s" readonly="true"><options>Project notes
|
||||
Project name
|
||||
Language
|
||||
Zoom blocks
|
||||
Stage size
|
||||
Stage scale</options></input><input type="%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>which</l><l>value</l></list><l>var stage = this.parentThatIsA(StageMorph),
 ide = stage.parentThatIsA(IDE_Morph),
 world = stage.parentThatIsA(WorldMorph);

try {
ide.savingPreferences = false;

switch (which) {
 case 'Project notes':
 ide.projectNotes = value;
 break;
 case 'Project name':
 ide.setProjectName(value);
 break;
 case 'Language':
 ide.setLanguage(value);
 break;
 case 'Zoom blocks':
 if (!isNaN(value)) ide.setBlocksScale(Math.min(value, 12));
 break;
 case 'Stage size':
 if ((value instanceof List) && value.length()==2
 && !isNaN(value.at(1)) && !isNaN(value.at(2)))
 ide.setStageExtent(new Point(value.at(1), value.at(2)));
 break;
 case 'Stage scale':
 ide.toggleStageSize(value != 1, Math.max(0.1, value));
 break;
};
}
finally {ide.savingPreferences = true;
};</l></block><list><block var="which"/><block var="value"/></list></block></script></block-definition></blocks>
|
|
@ -10,3 +10,4 @@ setrgb.xml Set RGB or HSV pen color Set or report pen color as RGB (red, blue, g
|
|||
penTrails.xml Save and restore pictures drawn by pen Save and restore lines drawn and costumes stamped on the stage, or make a sprite costume from saved pen trails.
|
||||
try-catch.xml Catch errors in a script Run a script; if an error happens, instead of stopping the script with a red halo, run another script to handle the error. Also includes a block to cause an error with a message given as input. Also includes a block to create a script variable and give it a value.
|
||||
multiline.xml Allow multi-line text input to a block In general, text inputs allow only a single line. The MULTILINE block accepts multi-line text input and can be used in text input slots of other blocks.
|
||||
Eisenbergification.xml Provide getters and setters for all GUI-controlled global settings Eisenberg's Law: Anything that can be done from the GUI should be doable from the programming language, and vice versa.
|
||||
|
|
Ładowanie…
Reference in New Issue