kopia lustrzana https://github.com/backface/turtlestitch
rodzic
d95c7b4696
commit
2fd4794a99
|
@ -1,4 +1,4 @@
|
|||
<blocks app="Snap! 4.1, 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
|
||||
<blocks app="Snap! 4.1, http://snap.berkeley.edu" version="1"><block-definition s="setting %'which'" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true"><options>Project notes
|
||||
Project name
|
||||
User
|
||||
Presentation mode
|
||||
|
@ -20,7 +20,8 @@ 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 world.keyboardReceiver instanceof ScriptFocusMorph;
 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
|
||||
Inheritance support
|
||||
Visible palette</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 world.keyboardReceiver instanceof ScriptFocusMorph;
 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;
 case 'Visible palette':
 return ide.currentCategory;
}</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><translations></translations><inputs><input type="%s" readonly="true"><options>Presentation mode
|
||||
Retina display support
|
||||
Long form input dialog
|
||||
Plain prototype labels
|
||||
|
@ -35,9 +36,10 @@ 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),
 thisObj = this;

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':
 if (tf != (world.keyboardReceiver instanceof ScriptFocusMorph)) {
 thisObj.scripts.toggleKeyboardEntry();
 };
 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
|
||||
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),
 thisObj = this;

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':
 if (tf != (world.keyboardReceiver instanceof ScriptFocusMorph)) {
 thisObj.scripts.toggleKeyboardEntry();
 };
 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><translations></translations><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>
|
||||
Stage scale
|
||||
Visible palette</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;
 case 'Visible palette':
 ide.currentCategory = value.toLowerCase();
 ide.categories.children.forEach(function (each) {
 each.refresh();
 });
 ide.refreshPalette(true);
 break;
};
}
finally {ide.savingPreferences = true;
};</l></block><list><block var="which"/><block var="value"/></list></block></script></block-definition></blocks>
|
Ładowanie…
Reference in New Issue