kopia lustrzana https://github.com/backface/turtlestitch
1 wiersz
11 KiB
XML
1 wiersz
11 KiB
XML
<blocks app="Snap! 6, https://snap.berkeley.edu" version="1"><block-definition s="setting %'which'" type="reporter" category="sensing"><comment w="254.66666666666666" collapsed="false">Allows reading global settings programmatically.

Eisenberg's Law: Anything you can do from the user interface you should be able to do in your program, and vice versa. This library is just a beginning; there are many UI controls outside of the Settings menu.</comment><header></header><code></code><translations>pt:o valor da configuração _
</translations><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
Visible stepping
Thread safe scripts
Prefer smooth animations
Flat line ends
Codification support
Inheritance support
Hyper blocks 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 ide.cloud.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 !!this.scripts.focus;
 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;
 case 'Hyper blocks support':
 return Process.prototype.enableHyperOps;
 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"><comment w="254.66666666666666" collapsed="false">Allows changing global settings programmatically.
This block is for Boolean (checkbox) settings; use
SET VALUE for numeric or text values.

Eisenberg's Law: Anything you can do from the user interface you should be able to do in your program, and vice versa. This library is just a beginning; there are many UI controls outside of the Settings menu.</comment><header></header><code></code><translations>pt:altera o valor da configuração _ para _
</translations><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
Visible stepping
Thread safe scripts
Prefer smooth animations
Flat line ends
Codification support
Inheritance support
Hyper blocks 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 (thisObj.scripts.focus && !tf) {
 thisObj.scripts.focus.stopEditing();
 } else if (tf && !thisObj.scripts.focus) {
 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;
 case 'Hyper blocks support':
 Process.prototype.enableHyperOps = tf;
 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"><comment w="254.66666666666666" collapsed="false">Allows changing global settings programmatically.
This block is for numeric or text settings; use
SET FLAG for Boolean (checkbox) values.

Eisenberg's Law: Anything you can do from the user interface you should be able to do in your program, and vice versa. This library is just a beginning; there are many UI controls outside of the Settings menu.</comment><header></header><code></code><translations>pt:altera o valor da configuração _ para _
</translations><inputs><input type="%s" readonly="true"><options>Project notes
Project name
Language
Zoom blocks
Stage size
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> |